Question Asp.net with back end MSaccess 2007

vks_gautam1

New member
Joined
Sep 27, 2010
Messages
1
Programming Experience
Beginner
My code

q = "insert into User_Detail(User_Name,Password,User_Type)values('" & TextBox1.Text & "'),('" & TextBox2.Text & "'),('" & DropDownList1.SelectedItem.Text & "')"
cn = New OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=E:\online.accdb;Persist Security Info=False;")
cn.Open()
cmd = New OleDbCommand(q, cn)
cmd.ExecuteNonQuery()
Response.Write("Entry Successful")
cn.Close()

Error = "Could not find file 'E:\online.mdb'.

Yesterday i was getting this error--"The 'Microsoft.ACE.OLEDB.12.0' provider is not register"
i think there is some issue with ms office version..currently i'm using ms office 2007...
 
Last edited:
G'd evening vks,
I think that the problem is that your db should be in your website's folder inside the appdata subfolder, so you can set it's path to something like this
VB.NET:
strDbPath =  HttpContext.Current.Server.MapPath("") & "\App_Data\online.accdb"
strConn = "provider=microsoft.ACE.oledb.12.0 ;data source=" & strDbPath & ";Persist Security Info=False;"

Also notice that in your connection string you have "online.accdb" and in the error you get the Db's name is 'online.mdb'.
Good luck
 
Back
Top