Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb.net connecting to an Access database on web server

Status
Not open for further replies.

cramd2

Programmer
Jun 10, 2005
51
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top