0

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.

5
  • 1
    Please tell us, in detail, how it "doesn't work". Commented Jun 22, 2010 at 23:56
  • File 'c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Learning.mdb' not found. Commented Jun 22, 2010 at 23:58
  • c: \ Program Files \ Microsoft Visual Studio 9.0 \ Common7 \ IDE \ ~ \ Learning.mdb 'is not a valid path. Make sure the name of the path is correct and a connection is established with the server on which the file resides. Commented Jun 22, 2010 at 23:59
  • ok does the file exist there? Commented Jun 23, 2010 at 0:02
  • Sure, it work just if I specify the full path like : "C:\Users\ZiGi\Desktop\IHM\Learning\Learning.mdb" And my website is inside the folder Learning\ Commented Jun 23, 2010 at 0:05

1 Answer 1

4

Try:

        Dim CX As OleDbConnection = New 
    OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &
 System.AppDomain.CurrentDomain.BaseDirectory & "/Learning.mdb") 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.