Hi Sakti,
use DSN connection.. kind follow the step below..
1st step..
place the db on any machine on lan.. share out the folder for public access with read & write permission set on..
2nd step..
create ODBC connection on client machine.. point the db path properties to the shared folder path location..
3rd step.. the sample code segment..
lest assume your ODBC connection is named (MyTestODBC).. ok..
Requires project reference to Microsoft ActiveX Data Objects 2.x Library
-
Dim oConnection As ADODB.Connection
-
Dim oRecordset As ADODB.Recordset
-
Dim sMsg As String
-
Dim sConnectString As String
-
Dim sSQL As String
-
-
sConnectString = "DSN=MyTestODBC Data;OLE DB Services=-2;"
-
sSQL = "SELECT Name FROM Employee"
-
Set oConnection = New ADODB.Connection
-
Set oRecordset = New ADODB.Recordset
-
-
oConnection.Open sConnectString
-
oRecordset.Open sSQL, oConnection, adOpenStatic, adLockOptimistic
-
sMsg = "**********************" & Chr(10)
-
Do While (Not oRecordset.EOF)
-
sMsg = sMsg & oRecordset.Fields("Name") & Chr(10)
-
oRecordset.MoveNext
-
Loop
-
sMsg = sMsg & "**********************" & Chr(10)
-
MsgBox sMsg
-
-
oRecordset.Close
-
Set oRecordset = Nothing
-
oConnection.Close
-
Set oConnection = Nothing
-