Are you using the SLX OLE-DB provider? If so.. the user name ADMIN will work and any other user name setup in the SLX Administrator. Security will be applied to each login as well.
We use FoxPro on occasion as well and there were a few things I had to do to get the SLX OLE-DB provider to work. Below is a procedure used to create a connection and execute a query
PROCEDURE l_SLXOpen() * This script handles the ADO Connection and uses a CursorAdapter object * to retrieve data to a cursor. PUBLIC oCA as CursorAdapter LOCAL oConn as ADODB.Connection LOCAL oRS as ADODB.Recordset LOCAL oException AS Exception LOCAL cConnString LOCAL llReturn
llReturn = .t.
* Handle connections - insert connection code cConnString = [Provider=SLXOLEDB.1assword=userpasswordersist Security Info=True;User ID=admin;Initial Catalog=SALESLOGIXDBNAME;Data Source=SLXSERVERNAME;Extended Properties="PORT=1706;LOG=ON"]
TRY oConn = createobject('ADODB.Connection')
* Ensure that you handle userid and password if not * specified in connection string. * ex. oConn.Open(cConnString, userid, password) oConn.Open(cConnString)
oRS = CREATEOBJECT("ADODB.Recordset") oRS.DataSource.CursorLocation = 3 &&adUseClient oRS.DataSource.LockType = 3 &&adLockOptimistic oRS.ActiveConnection = oConn
oCA=CREATEOBJECT("CursorAdapter") oCA.DataSourceType = "ADO" oCA.DataSource = oRS oCA.MapBinary = .T. oCA.MapVarchar = .T.
oCA.Alias = "A_ADDRESS" oCA.SelectCmd = "SELECT a.addressid, a.address1, a.address2, a.city, a.county, a.state, c_latitude, c_longitude, ISNULL(a.postalcode,'') AS postalcode, ISNULL(CASE LEFT(a.entityid, 1) WHEN 'C' THEN b.workphone ELSE c.mainphone END, '') AS phone FROM address a" + ; " LEFT JOIN contact b ON a.entityid = b.contactid" + ; " LEFT JOIN account c ON a.entityid = c.addressid" IF !oCA.CursorFill() * Replace with error code here LOCAL laError DIMENSION laError[1] AERROR(laError) MESSAGEBOX(laError[2]) llReturn = .f. ELSE * Replace with user code here. Code below allows for * you to edit and send updates to the backend. LOCAL laFlds,lcStr,lnFldCount,i DIMENSION laFlds[1] lnFldCount=AFIELDS(laFlds) lcStr="" FOR i = 1 TO lnFldCount lcStr = lcStr + laFlds[m.i,1] + "," ENDFOR oCA.UpdatableFieldList = lcStr ENDIF
CATCH TO oException * Replace with exception handling code here llReturn = .f. MESSAGEBOX(oException.Message, 48, 10000) ENDTRY
RETURN llReturn
ENDPROC && l_SLXOpen
|