Jasmine Appelblad Jasmine Appelblad - 4 months ago 66
ASP.NET (C#) Question

CRUD with Access Database using ASP.NET

How can I use Microsoft Access as a database in ASP.NET website? Is it possible?


Yes it possible. You will have to use OLEDB to Access the MS Access Database.

Dim con As New System.Data.OleDb.OleDbConnection

   Dim myPath As String
   myPath = Server.MapPath("Database1.mdb")

   con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data source=" & myPath & ";"
   Dim myCommand As New System.Data.OleDb.OleDbCommand

   myCommand.CommandText = "insert into Students(Firstname,Lastname,Address) values('" & txtFirstname.Text & "','" & txtLastname.Text & "','" & txtAddress.Text & "')"
   myCommand.Connection = con

Taken from: http://www.beansoftware.com/ASP.NET-Tutorials/Connecting-Access-Sql-Server.aspx

It would be the same as SQL Server but you will be using OleDbConnection, OleDbCommand etc