【发布时间】:2014-09-04 21:40:59
【问题描述】:
我正在尝试根据 cookie 中的值将详细信息插入表中,.这是代码
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
conn.Open();
string insertQuery = "insert into Details (Employees, Performance, TotalPerformance, Attitude, TotalAttitude) values(@employees, @performance ,@totalPerformance, attitude, totalAttitude)";
SqlCommand com = new SqlCommand(insertQuery, conn);
com.Parameters.AddWithValue("@employees", Request.QueryString["employees"]);
com.Parameters.AddWithValue("@performance", totalPer.ToString());
com.Parameters.AddWithValue("@totalPerformance", totalPercent.ToString());
com.Parameters.AddWithValue("@attitude", totalAtt.ToString());
com.Parameters.AddWithValue("@totalattitude", totalPercent.ToString());
com.ExecuteNonQuery();
这很好用,但是在字符串插入查询行中,我想在 where 子句中添加,如果所述行中的列“name”的值与 cookie 匹配,它将在其中将值插入特定行。我不知道正确的语法 感谢您的帮助
【问题讨论】:
-
感谢小伙伴们的帮助