Updatable query?

AznCutie

Member
Joined
Nov 13, 2002
Messages
16
Location
West coast
Hi, Im trying to add a user to a database, but my codes defunct...

Code:
Sub doSignup(Source as Object, E as EventArgs)
	Dim strFname as string=frmfname.text
	Dim strLname as string =frmlname.text
	Dim strEmail as string =frmemail.text
	Dim struid as string =frmuid.text
	Dim strpwd as string =frmpwd.text

	Dim MySQL as string = "Insert into logintutorial (fname, lname, email, uid, pwd) values (" & _
			strfname & ", " & strlname & ", " & _
			strEmail & ", " & struid & ", " & strpwd & ")"

	Dim myConn As OleDbConnection = _
		New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
		server.mappath("loginTutorial.mdb") & ";")

	Dim Cmd as New OleDbCommand(MySQL, MyConn)
	MyConn.Open()
	Cmd.ExecuteNonQuery
	label1.text = "Its Done!"
End Sub

When I try to run it, it errors out at "Cmd.ExequteNonQuery" and the exception details are...

Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.

...Yay... I love defunct code... :(
 
Last edited by a moderator:
In my experience this happens, when the db file cannot be modified or overriten. This is a very common problem in web applications, since the normal user does not have write access hence it cant update the database. But in applications in such as vd.net this may happen in the following cases.
The database is marked as read - only (try to see this with MS Access)
You dont have permitions to write to the specific directory.
Try to change the server.mappath
Try using the Data source without the server.mappath
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db.mdb
There is a possiblity that when you use the server mappath tries to access the file as guest and not as the logged on user. (Bug)
 
Is this an ASP.NET page? If it is, you need to make sure that you
have write access to the database on the server through the IIS
control panel.
 
Back
Top