I have been researching the option of creating a vb.net program that will read data from an Access database on a remote web server. I've tested several examples that I've gathered from this forum and other web sites, but still no luck. I'm looking for any examples that someone can tell me if it actually works - I have not found many examples on the internet regarding this scenario, which also makes me wonder if this is actually possible?
Below is code that I have been testing with:
Dim strConString as string
Dim strSQL as string
'assign connection string
strConString = "Provider=MS Remote;
Remote Server=remote provider=Microsoft.Jet.OLEDB.4.0;
Data Source=exampleDir\accessDatabase.mdb;
'initialize connection object variable
adoConn = New ADODB.Connection
'open connection
adoConn.Open(strConString, "admin", "password")
strSQL = "Select * from Customers"
'initialize recordset object variable
adoRst = New ADODB.Recordset
With adoRst
Try
.Open(strSQL, adoConn, ADODB.CursorTyeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adlockReadOnly)
MsgBox("Made it")
Catch e As Exception
MsgBox(e.Message, MsgBoxStyle.OKCancel)
End Try
If Not .EOF Then
Do While Not .EOF
'read each recod here
.MoveNext
Loop
.Close
End If
End With
'destroy recordset
adoRst = Nothing
'destroy connection
adoConn = Nothing
cramd2
Below is code that I have been testing with:
Dim strConString as string
Dim strSQL as string
'assign connection string
strConString = "Provider=MS Remote;
Remote Server=remote provider=Microsoft.Jet.OLEDB.4.0;
Data Source=exampleDir\accessDatabase.mdb;
'initialize connection object variable
adoConn = New ADODB.Connection
'open connection
adoConn.Open(strConString, "admin", "password")
strSQL = "Select * from Customers"
'initialize recordset object variable
adoRst = New ADODB.Recordset
With adoRst
Try
.Open(strSQL, adoConn, ADODB.CursorTyeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adlockReadOnly)
MsgBox("Made it")
Catch e As Exception
MsgBox(e.Message, MsgBoxStyle.OKCancel)
End Try
If Not .EOF Then
Do While Not .EOF
'read each recod here
.MoveNext
Loop
.Close
End If
End With
'destroy recordset
adoRst = Nothing
'destroy connection
adoConn = Nothing
cramd2