求高手指教:怎样访问和操作用路由器组建的局域网内另一台电脑的VFP数据库表?
求高手指教:怎样访问和操作用路由器组建的局域网内另一台电脑的数据库表?
程序代码:
* 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
* Handle connections - insert connection code
cConnString = [Provider=SQLOLEDB.1;Data Source=(LOCAL);Initial Catalog=lis2002;User ID=;Password=;Integrated Security=SSPI]
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 = "bld_ill"
oCA.SelectCmd = "SELECT * FROM bld_ill"
IF !oCA.CursorFill()
* Replace with error code here
LOCAL laError
DIMENSION laError[1]
AERROR(laError)
MESSAGEBOX(laError[2])
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
BROWSE NORMAL NOWAIT
ENDIF
CATCH TO oException
* Replace with exception handling code here
MESSAGEBOX(oException.Message)
ENDTRY
* Add user code here.
* Note: cursors created by CursorAdapter object are closed when object is released.
