ASP.NET 2.0 and MS Access

Hi,

I'm new to ASP.NET development and I'm currently developing a small website for a company in ASP.NET 2.0.

As ASP.NET 2.0 Beta 2 doesn't provide the MS Access Provider, I would like to now if anybody could help me in installing this provider (this because the MS Access is free at my ISP side)

I noticed on the website of Microsoft, that an MS Access provider is available for download, but you need to compile it with Visual C# and I don't have a glue how to do this.

Could someone help me with this I would like to store some visitor information into this database.....

Thank you a lot guys,
B.


Answer this question

ASP.NET 2.0 and MS Access

  • Steve Chowles

    Hi,

    You can connect to an MS Access database by using the OleDb provider. Use the OleDb namespace in accessing data from access:

    using System.Data.OleDb;

    OleDbConnection oConn = new OleDbConnection(<myConnectionString>);
    oConn.Open();

    BTW, on future questions regarding ASP.Net please post in the forums.asp.net you may find a better chance of being answered there...

     

    cheers,

    Paul June A. Domag



  • TohKung

    Hi Paul,

    Thanks for the information, but could you give me an example if I would like to connect to an MS Access database (c:\app\test.mdb)
    I would like to store some visitor information like FirstName, LastName, Address, Company, Telephone, etc. into this MS Access DB.

    I thank you for your response....

    Bart

  • Dennis Pillay

    Hi,

    Here's an example of simply connecting on a database:

    using System.Data.OleDb;
    ...

    //on your page load
    OleDbConnection con = new OleDbConnection(@"PROVIDER=Microsoft.Jet.OleDb.4.0;Data Source="C:\app\test.mdb");
    con.Open();
    OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM myTable", con);
    DataSet ds = new DataSet();
    adapter.Fill(ds);
    dataGrid1.DataSource = ds;
    dataGrid1.DataBind();

    This sample opens your database and binds it to a grid...

     

    cheers,

    Paul June A. Domag



  • ASP.NET 2.0 and MS Access