asp.net - how to insert records from a aspx.vb file to a mdb datase code -
hey there evening can tell me whats wrong code? i'm getting 'operation not updateable' error 1 below
server error in '/' application. operation must use updateable query. description: unhandled exception occurred during execution of current webrequest. please review stack trace more information error , originated in code. exception details: system.data.oledb.oledbexception: operation must use updateable query. source error: line 20: cmd.parameters.addwithvalue("paswords", textbox4.text) line 21: conn.open() line 22: cmd.executenonquery() line 23: end using line 24: end using
my code
imports system.web.security imports system.data imports system.data.oledb imports system.configuration imports system.web.configuration partial class registration inherits system.web.ui.page protected sub button1_click(byval sender object, byval e system.eventargs) handles button1.click dim connstring string = "provider=microsoft.jet.oledb.4.0;data source=|datadirectory|onlineregistration.mdb" dim sqlstring string = "insert registration (firtsname, telephone, email, paswords) values (?,?,?,?)" using conn new oledbconnection(connstring) using cmd new oledbcommand(sqlstring, conn) cmd.commandtype = commandtype.text cmd.parameters.addwithvalue("firtsname", textbox1.text) cmd.parameters.addwithvalue("telephone", textbox2.text) cmd.parameters.addwithvalue("email", textbox3.text) cmd.parameters.addwithvalue("paswords", textbox4.text) conn.open() cmd.executescalar() end using end using end sub end class
that error "must use updateable query" tipically thrown when mdb file write-only, or when there no write permission on file.
Comments
Post a Comment