Data type mismatch in criteria expression error in C# trying to insert data in Microsoft Access using ASP.net -
private oledbconnection bookconn; private oledbcommand oledbcmd = null; private string connparam; protected void page_load(object sender, eventargs e) { } protected void btnsubmitform_click(object sender, eventargs e) { if (page.isvalid) { connparam = @"provider=microsoft.ace.oledb.12.0;data source=" + server.mappath("validation.accdb") + ";persist security info=false;"; bookconn = new oledbconnection(connparam); bookconn.open(); oledbcmd = new oledbcommand("insert tblclients(firstname,lastname, phone, streetaddress, city, zipcode) values('" + fname.text + "','" + lname.text + "'," + convert.toint64(phone.text) + ",'" + address.text + "','"+ city.text + "', " + convert.toint32(zipcode.text) + ")", bookconn); oledbcmd.executenonquery(); bookconn.close(); response.redirect(httpcontext.current.request.path); } }
all know problem in insert into
command.
firstname
,lastname
,streetaddress
,city
strings , phone
& zipcode
integers. i'm not sure how fix error :/
Comments
Post a Comment