string moSql ="update wwe set gq="+aa+","+"dm="+bb;
SqlCommand cmd = new SqlCommand(moSql,cm);

解决方案 »

  1.   

    string moSql ="update wwe set gq="+aa+","+"dm="+bb;
    修改为
    string moSql ="update wwe set gq='"+aa+"',"+"dm='"+bb+ "'";试一下
      

  2.   

    提示错误:违反了 PRIMARY KEY 约束 'PK_gqk'。不能在对象 'gqk' 中插入重复键。语句已终止。
      

  3.   

    SqlCommand cmd=new SqlCommand("update wwe set gq='"+aa+"',"+"dm='"+bb+ "'",cn);
      

  4.   

    按上面的语句执行,会把一个字段的所有记录替换,如果叫WHERE 条件,
    该如何写?
      

  5.   

    加where 条件,
    你把数据源表中的一个关键字,也加到DATAGRID中,然后把这个字段隐藏
    比如,表中有一关键字ID
       则:
    dim int1 as integer
    int1= mydatagrid.DataKeys(e.Item.ItemIndex)
    则WHERE语句为:
     where ID=int1