Farmer
Farmer

Reputation: 10983

Problem while connecting to DataBase ASP.NET

I have a database in the same workspace, I've tried to connect to this DB using this codes :

Dim CX As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & "./Learning.mdb")

Dim CX As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & "~/Learning.mdb")

Dim CX As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & "~Learning.mdb")

But none of them work.

Upvotes: 0

Views: 211

Answers (1)

JBrooks
JBrooks

Reputation: 10013

Try:

        Dim CX As OleDbConnection = New 
    OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &
 System.AppDomain.CurrentDomain.BaseDirectory & "/Learning.mdb") 

Upvotes: 4

Related Questions