0
我在c#中的项目为用户名和cookie记忆的单用户身份验证创建临时表。使用cookie名称创建更新表mysql创建
现在我需要更新该临时表与MySQL的cookie的名称创建,但我有此错误:
Compiler Error Message: CS1010: Newline in constant
有什么不对?
我的代码如下。
private void UpdateProduct(string productID)
{
string sql = String.Format(@"Update `tbl_" + Request.Cookies["userName"].Value + "`
set Product = 1
where ID = {0}",
productID);
using (OdbcConnection cn =
new OdbcConnection(ConfigurationManager.ConnectionStrings["MySQL"].ConnectionString))
{
cn.Open();
using (OdbcCommand cmd = new OdbcCommand(sql, cn))
{
cmd.ExecuteNonQuery();
}
}
}