Access Database

Discussion in 'Databases' started by leisurehours, Jul 24, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Having problems opening connection to a ms access database 2010


    I uploaded my database to _database
    I am using the following C# code to check for a open connection to my database the c# code is :



    string connetionString = null;
    String FilePath = Server.MapPath("maindata.accdb");

    OleDbConnection cnn;

    connetionString = "Provider=Microsoft.Jet.OLEDB.12.0;Data Source=" + Server.MapPath("maindata.accdb");

    cnn = new OleDbConnection(connetionString);



    try
    {
    cnn.Open();

    Label1.Text= FilePath + "---- Opened !!!!!!!!!!!!!";

    cnn.Close();

    }
    catch (Exception ex)
    {

    Label1.Text = Filepath + " --not opened";

    }


    I can code this to work on my local machine but when I change the code to work on discount asp I get a not opened connection, I can also get the file path.

    I looked at all the examples but they are in VB and I do not understand vb

    Thanks
    Any help would be appreciated, Once I can connect to my database I can go from there

    - Regards Dennis
     
  2. Hi,
    I couldn't get the .accdb version to work on-line either.
    Had to step it back to the .mdb version.
    If there is a way to get the 2010 extension working hopefully someone here will post their solution. ;-)
    All the best,
    Mark
     
  3. Hi,

    Thank you for a response I was trying to get this to work for the last 3 days. If I step back to .mdb, Will my code work or am I still missing something ?



    My File path shows it is on E: drive

    Regards
    Dennis
     
  4. ...Yes the .mdb version will work.
    I created a sample ASP.NET page with both versions on IIS7 and the .mdb version worked very well.
    All the best,
    Mark
     
  5. Hi,

    Problem solved, I had to use a .mdb version and had to use "Provider=Microsoft.Jet.OLEDB.4.0 - 12.0 did not work.


    Thanks
    Dennis
     
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