AznCutie Posted March 29, 2003 Posted March 29, 2003 (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 March 29, 2003 by Robby Quote
wyrd Posted March 29, 2003 Posted March 29, 2003 Should be Cmd.ExecuteNonQuery() .. it's not a property. :) Quote Gamer extraordinaire. Programmer wannabe.
AznCutie Posted March 29, 2003 Author Posted March 29, 2003 Should be Cmd.ExecuteNonQuery() .. it's not a property. :) I still get the same error. Quote
Moderators Robby Posted March 29, 2003 Moderators Posted March 29, 2003 are you sure you put the () Quote Visit...Bassic Software
philprice Posted March 29, 2003 Posted March 29, 2003 just a tip, dont call your sql "mysql" it could get confusing for developers at there is a SQL server called "MySQL" ;) Quote Phil Price� Visual Studio .NET 2003 Enterprise Edition Microsoft Student Partner 2004 Microsoft Redmond, EMEA Intern 2004
otherside Posted March 29, 2003 Posted March 29, 2003 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) Quote
AznCutie Posted March 29, 2003 Author Posted March 29, 2003 Yes, I did put in the () and got the same results. As far as trying to see if the mdb is read only, how do I do that? Quote
*Experts* Volte Posted March 30, 2003 *Experts* Posted March 30, 2003 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. Quote
AznCutie Posted March 30, 2003 Author Posted March 30, 2003 Nope... still didn't work. Grrr this is starting to annoy me. Quote
AznCutie Posted March 30, 2003 Author Posted March 30, 2003 Okay, hehe I fixed it It was the security settings that were setting this off. http://www32.brinkster.com/lchang82/final/WebForm1.aspx The only thing left for me to figure out is how to disable logging... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.