Connecting to Access DB

Discussion in 'Databases' started by srhone, Aug 2, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. This also worked but thanks for the help.

    string strConn = @"Provider=Microsoft.Jet.OleDB.4.0;Data Source=E:\web\myDir\htdocs\_database\chemistry.mdb;User ID=Admin";

    quote:Originally posted by bruce

    You are using the wrong path.

    use this instead

    conn.ConnectionString = "Provider=Microsoft.Jet.OleDB.4.0;Data Source=" & server.mappath("/_database/chemistry.mdb") & ";User ID=Admin";




    quote:Originally posted by srhone

    I get an error connecting to my Access Db using Code-beind. The code is below can anyone help? The database is in the _database folder

    The error I'm getting:
    'c:\_database\chemistry.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.


    The code:
    OleDbConnection conn = new OleDbConnection();
    conn.ConnectionString = "Provider=Microsoft.Jet.OleDB.4.0;Data Source=/_database/chemistry.mdb;User ID=Admin";
    conn.Open();
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  2. I get an error connecting to my Access Db using Code-beind. The code is below can anyone help? The database is in the _database folder

    The error I'm getting:
    'c:\_database\chemistry.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.


    The code:
    OleDbConnection conn = new OleDbConnection();
    conn.ConnectionString = "Provider=Microsoft.Jet.OleDB.4.0;Data Source=/_database/chemistry.mdb;User ID=Admin";
    conn.Open();
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    You are using the wrong path.

    use this instead

    conn.ConnectionString = "Provider=Microsoft.Jet.OleDB.4.0;Data Source=" & server.mappath("/_database/chemistry.mdb") & ";User ID=Admin";




    quote:Originally posted by srhone

    I get an error connecting to my Access Db using Code-beind. The code is below can anyone help? The database is in the _database folder

    The error I'm getting:
    'c:\_database\chemistry.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.


    The code:
    OleDbConnection conn = new OleDbConnection();
    conn.ConnectionString = "Provider=Microsoft.Jet.OleDB.4.0;Data Source=/_database/chemistry.mdb;User ID=Admin";
    conn.Open();
    </blockquote id="quote"></font id="quote">
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page