日期:2014-05-18  浏览次数:20443 次

请教,在方法里面不可以workid='"+e.Item.Cells[1].Text+"' 用这样的格式吗?谢谢
public void piLiang()
{
string sql3="update nb_JiaBanLog set Checked = 'y' where FormNumber='"+这地方应怎样写+"' and WorkId='"+ 这地方应怎样写+"' ";
SqlConnection Con = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Con"]);
Con.Open();
SqlCommand cmd = new SqlCommand("",Con);
}

谢谢了.

------解决方案--------------------
最好用format函数,看上去比较清晰

string.format("SELECT * FROM tempTable WHERE UserName='{0}'", UserName.Text);