ms access 2003 - Data type mismatch in criteria expression c# -
the following exception thrown when run below code:
system.data.oledb.oledbexception data type mismatch in criteria expression
private void buttonup_click(object sender, eventargs e) { try { connection.open(); oledbcommand command = new oledbcommand(); command.connection = connection; string query = "update data set name ='"+txtnl.text+"' , period ='"+txtper.text+"' , dob = '"+txtmonth.text+"', price = '"+txtprice.text+"', follow = '"+combofw.text+"' id = "+txtid.text+" "; //(id,name,period,dob,price,follow) messagebox.show(query); command.commandtext = query; command.executenonquery(); messagebox.show("data edited/updated successful"); connection.close(); } catch (exception ex) { messagebox.show("error " + ex); } }
how can fix this?
one of inputs not match data type database table expecting. example if pass"abbx" date text , table expecting datetime, it's not going work. make sure match types in input 1 table has.
Comments
Post a Comment