在c#中写修改数据库的语句这样写
update table set '"+y+"'='"+x"' where column='11'
可以实现吗?如果不能要怎么做呢?

解决方案 »

  1.   

    string sql = string.Format("update table set y='{0}' where column='11'", yValue); 
      

  2.   


    实现的话的你那必须有前提、那个红色"+y+"的是你数据表里的一列。
    "+x" 绿色的是参数或者是一个值。
    如果是参数那就要用Coommand 对象去添加、如果是值建议你使用这种方式string。format(“update table set '"+y+"'={0} where column='11'",你要更新的值 )