d kris

d kris

  • NA
  • 4
  • 0

syntax error in update statement

Apr 14 2010 5:52 AM
Hello,
I have been trying desperately to resolve the problem but to no avail...  An oledb exception "syntax error in update statement is encountered...I have checked for everything possible including reserved keywords (the Amt_Paid? column is thus put in brackets  )...
please help ....any help would be appreciated....Here's the code:



DialogResult result=MessageBox.Show("Do you want to check payment details again?","Verify before Proceeding",MessageBoxButtons.YesNo);
            string amntpd = "Yes";
            string cnstrcl;
            if (result == DialogResult.No)
            {
                  cnstrcl = ConfigurationManager.ConnectionStrings["WindowsFormsApplication3.Properties.Settings.ClienteleConnectionString"].ConnectionString;
                OleDbConnection cl = new OleDbConnection();
                cl.ConnectionString = cnstrcl;
                cl.Open();
                string uppay = string.Format("update Invoice set [Amt_Paid?] like '{0}',Cheque_No='{1}',Cheque_Date like '{2}',Bank_Withdrawn='{3}',Bank_Deposited='{4}' where Bill_No='{5}'",amntpd.Trim(),txtCheNo.Text, dtCheDate.Value, txtbankwith.Text, cmbbankdep.SelectedItem.ToString(), cmbinvoice.SelectedValue.ToString()); 
                using (OleDbCommand cmd = new OleDbCommand(uppay, cl))
                {
                    cmd.ExecuteNonQuery();
                }  
                cl.Close();
                MessageBox.Show("Updated Successfully");




Answers (1)