SqlConnection con =
new SqlConnection
(@"Data Source=SAMA-PC\SQLEXPRESS;Initial Catalog=advCenter;
Integrated Security=True");
SqlCommand com1 = new SqlCommand(
"select visited_link
from links
where [user_email]=@ue and [visited_link]=@vl",con);
com1.Parameters.AddWithValue("@ue",Convert.ToString(Session["mail"]));
com1.Parameters.AddWithValue("@vl", ImageButton1.ID);
con.Open();
SqlDataReader dr;
dr = com1.ExecuteReader();
if (dr.HasRows)
{
Label2.Text = "wrong";
}
答案 0 :(得分:0)
我想你可以试试
command.Parameters.Add("@ue", SqlDbType.NText)
command.Parameters("@ue").Value = Convert.ToString(Session["mail"]);
显式指定列数据类型。
答案 1 :(得分:0)