string UpdateStr="Update Suppliers set"
+"CompanyName= '"+CompanyName+"',ContactName='"+ContactName+"',ContactTitle='"+ContactTitle+"',Address='"+Address+"',City='"+City+"',Region='"+Region+"',PostalCode='"+PostalCode+"',Country='"+Country+"',Phone='"+Phone+"',Fax='"+Fax+"',HomePage='"+HomePage+"'+where SupplierID = "+SupplierID;
能不能告诉我在ASP。NET中插入SQL语句应该怎么写,什么时候加空格,什么时候用什么样的引号呀

解决方案 »

  1.   

    注意空格~string UpdateStr="Update Suppliers set "
    +"CompanyName= '"+CompanyName+"',ContactName='"+ContactName+"',ContactTitle='"+ContactTitle+"',Address='"+Address+"',City='"+City+"',Region='"+Region+"',PostalCode='"+PostalCode+"',Country='"+Country+"',Phone='"+Phone+"',Fax='"+Fax+"',HomePage='"+HomePage+"' where SupplierID = "+SupplierID;
      

  2.   

    "+HomePage+"'+"  where SupplierID = "+SupplierID;
      

  3.   

    有2个地方要改:
    1)HomePage='"+HomePage+"' where SupplierID = "+SupplierID;
    2)="Update Suppliers set "
      

  4.   

    ...HomePage='"+HomePage+"'+where SupplierID = "+...
    where这里不是明显少了个空格吗?
    SQL变成 ...HomePage='XXXX'where SupplierID =....
    where前面这里没有空格    !!
      

  5.   

    怎么写呢,就是这种SQL语句,我一写就乱