Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi, I'm trying to add a user to a database, but my code's defunct...

 

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 = "It's 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... :(

Edited by Robby
Posted
just a tip, dont call your sql "mysql" it could get confusing for developers at there is a SQL server called "MySQL" ;)

Phil Price�

Visual Studio .NET 2003 Enterprise Edition

Microsoft Student Partner 2004

Microsoft Redmond, EMEA Intern 2004

Posted

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 can't 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 don't 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)

  • *Experts*
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...