c# - I got this error "Number of query values and destination fields are not the same." -
c# - I got this error "Number of query values and destination fields are not the same." -
this question exact duplicate of:
“number of query values , destination fields not same.”i got error :
syntax error insert statement syntax error insert statement syntax error insert statement syntax error insert statement syntax error insert statement
plss help me.
this right other 1 sql sorry
//server connection private void serverconnect() { string connstring; connstring = "provider=microsoft.ace.oledb.12.0;data source=plan.accdb"; tconn = new oledbconnection(connstring); tconn.open(); messagebox.show("you connected."); tconn.close(); } //add memos private void getmemolist() { string query; dataset ds = new dataset(); query = "select memo_id,date,time,memos tblmemo order date asc"; oledbdataadapter da = new oledbdataadapter(query, tconn); da.fill(ds); this.dgv1.datasource = ds.tables[0]; } private void addmemo(string memodate, string memotime, string memos) { tconn.open(); string acc; acc = "insert tblmemo (date,time,memos) values (@memodate,@memotime,@memos)"; oledbcommand cmd = new oledbcommand(acc,tconn); cmd.parameters.addwithvalue("@memdate", memodate); cmd.parameters.addwithvalue("@memtime", memotime); cmd.parameters.addwithvalue("@memos", memos); cmd.executenonquery(); tconn.close(); } private void btnaddmemos_click(object sender, eventargs e) { addmemo(this.dtpdate.value.toshortdatestring(), this.dtptime.value.toshorttimestring(), this.txtinfo.text.trim()); getmemolist(); txtinfo.clear(); } }
primary key of table may not set auto increment
c#
Comments
Post a Comment