string sql = string.Format("insert into Enzyme ( EnzymeName , Manufactory , CartNo , Specification , OrderNum , ReceiveNum , CreateBy ,CreateTime , BalanceNum) values ( '{0}', '{1}' , '{2}' ,'{3}' ,{4} , {5} , '{6}' , '{7}' , {8} )",enzyme.EnzymeName, enzyme.Manufactory, enzyme.CartNo, enzyme.Specification, enzyme.OrderNum, enzyme.ReceiveNum, enzyme.CreateBy, enzyme.CreateTime, enzyme.BalanceNum);
mySql.ExecuteSqlWithoutResult(sql);一个添加数据sql语句在数据库里 执行没任何问题,但是在程序里执行提示:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '12', '34' , '34' ,'34' ,34 , 34 , '4' , '2013/1/23 0:00:00' , 0 )'' at line 1
求教!
你使用的单引号,有问题,可以复制在数据库查询界面看看。
符号不对,这样就错误了