VB.NET MySQL Fatal Error But database accepts input -


i fatal error when execute code, info still shows in database. can see error here?

sql.runquery("insert test(test1,test2,test3) values(?fname,?lname,?dob)")              sql.sqlcmd.parameters.addwithvalue("?fname", gender.selecteditem)             sql.sqlcmd.parameters.addwithvalue("?lname", age)             sql.sqlcmd.parameters.addwithvalue("?dob", rdiage)              sql.sqlcmd.executenonquery() 

your code should looks like:

  dim connstring string = "database=yourdb;data source=localhost;";   connstring +="user id=youruserdb;password=dbpass"     dim conn new mysqlconnection(connstring)   dim cmd new mysqlcommand()   try     conn.open()     cmd.connection = conn      cmd.commandtext = "insert test(test1,test2,test3) values(@fname,@lname,@dob)"     cmd.prepare()      cmd.parameters.addwithvalue("@fname", gender.selecteditem)     cmd.parameters.addwithvalue("@lname", age)     cmd.parameters.addwithvalue("@dob", rdiage)     cmd.executenonquery()      conn.close()    catch ex mysqlexception       console.writeline("error: " & ex.tostring())   end try 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -