Results 1 to 4 of 4

Thread: What is wrong with the code

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2005
    Posts
    54

    What is wrong with the code

    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) ;
    			}
    Last edited by newmember; Oct 19th, 2005 at 01:44 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width