whateveragain
Programmer
I'm using VS 2008, SQL 2008, MS Access 2007 all on Vista OS. I'm trying to connect to an MS Access mdf file as my web site provider doesn't allow SQLExpress. I tried using the gooey data binder to determine the proper coding for the Access.mdf file, but all it gives me is "~/App_Data/whichdata.mdb". The following is the error message I'm receiving and below that is my code. What is wrong with my string? Thanks
Error msg:
[DBNETLIB][ConnectionOpen (Connect()).] SQL Server does not exist or access denied.
Invalid connection string attribute.
My code:
Dim oleconn As New OleDb.OleDbConnection()
oleconn.ConnectionString = "provider=sqloledb;database=~/App_Data/whichdata.mdb;trusted_connection=yes;connection timeout=30"
Try
oleconn.Open()
Catch oleerr As Exception
MsgBox(oleerr.Message)
MsgBox("connection error!")
End Try
If oleconn.State = 1 Then
Msgbox("Welcome to ado.net!")
End If
Dim olecomm As New OleDb.OleDbCommand()
olecomm.Connection = oleconn
olecomm.CommandText = "select count(*) from whichdata where sessionID like session.sessionID"
MsgBox(olecomm.ExecuteScalar, olecomm.CommandText)
Error msg:
[DBNETLIB][ConnectionOpen (Connect()).] SQL Server does not exist or access denied.
Invalid connection string attribute.
My code:
Dim oleconn As New OleDb.OleDbConnection()
oleconn.ConnectionString = "provider=sqloledb;database=~/App_Data/whichdata.mdb;trusted_connection=yes;connection timeout=30"
Try
oleconn.Open()
Catch oleerr As Exception
MsgBox(oleerr.Message)
MsgBox("connection error!")
End Try
If oleconn.State = 1 Then
Msgbox("Welcome to ado.net!")
End If
Dim olecomm As New OleDb.OleDbCommand()
olecomm.Connection = oleconn
olecomm.CommandText = "select count(*) from whichdata where sessionID like session.sessionID"
MsgBox(olecomm.ExecuteScalar, olecomm.CommandText)