当对一个数据进行更新时,比如更新用户的密码时,是需要此语句的:
update table set password = newpwd' where user = 'username';
此时newpwd,uerename往往是从程序中得到了,如何把它们插入到这个更新语句中呢,
可以这样:string sql = string.Format("update table set password = '{0}' where user = '{1}'", newpwd, username);
使用格式化的方法可以做到;