Hi all,
i m new to c#, can anybody please tell me what is wrong with this code why it is throwing error, there is only one records in dataset, and i m trying to update the table with the values in the data set
Error Message is : Command contains unrecognised phrase/key words
Code:try { foreach( DataRow dtrow in ds.Tables[0].Rows) { string mmicr,msortcode,maccount,msrl,mserial,mamount ; mmicr = dtrow["micr"].ToString().PadLeft(6,'0') ; maccount = dtrow["account"].ToString().PadLeft(6,'0') ; msortcode = dtrow["sortcode"].ToString() ; msrl = dtrow["srl"].ToString() ; mamount = dtrow["amount"].ToString().PadLeft(13,'0') ; mserial = dtrow["serial"].ToString() ; OleDbDataAdapter danew = new OleDbDataAdapter( "UPDATE " + dbfname + " set micr = '" + mmicr + "',account = '" + maccount + "',sortcode = '" + msortcode + "',amount = '" + mamount + "',srl = '" + msrl + "' where serial == '" + mserial , Dconn); DataTable dtnew = new DataTable() ; danew.Fill(dtnew) ; } } catch (Exception exp) { MessageBox.Show(exp.Message) ; }




Reply With Quote