c# - Data type Mismatch in criteria expression in MS Accss2010 -
i tried execute insert query, throwing above error. have given code below.
public string insertmovedetails(string desc, string currentlocation, string newlocation, string newbay, string requestedby, string movedby, string approvedby, datetime dateofmove) { string desc, currentlocation, newlocation, movedby, approvedby, requestedby,newbay; datetime dateofmove; desc = textboxdescription.text; currentlocation = textboxcurrentlocation.text; newlocation = comboboxnewlocation.text; movedby = comboboxmovedby.text; approvedby = comboboxapprovedby.text; dateofmove = datetimepickerdateofmove.value; newbay = textboxnewbay.text; requestedby = textboxrequestedby.text; con.open(); oledbcommand cmd1 = new oledbcommand("insert movedetails(descrptn, currentlocation, newlocation, newbay, requestedby, movedby, approvedby, dateofmove) values(@descrptn, @currentlocation, @newlocation, @newbay, @requestedby, @movedby, @approvedby, @dateofmove)", con); cmd1.parameters.addwithvalue("@descrptn", desc); cmd1.parameters.addwithvalue("@currentlocation", currentlocation); cmd1.parameters.addwithvalue("@newlocation", newlocation); cmd1.parameters.addwithvalue("@newbay", newbay); cmd1.parameters.addwithvalue("@requestedby", requestedby); cmd1.parameters.addwithvalue("@movedby", movedby); cmd1.parameters.addwithvalue("@approvedby", approvedby); cmd1.parameters.addwithvalue("@dateofmove", dateofmove); cmd1.executenonquery(); con.close(); return ""; }
my database columns , respective types
descrptn- text
currentlocation- text
newlocation- text
newbay- text
requestedby- text
movedby- text
approvedby- text
dateofmove- date/time
please me error. tried other threads same error, can't find answer.
try removing @ parameter , in sql replace parameters ?, dont think access supports named parameters.
Comments
Post a Comment