如果是通过detailsview是可以添加的,但是我希望通过textbox来添加
代码:
protected void Button2_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["aspConnectionString"].ConnectionString.ToString());
con.Open();
SqlCommand com = new SqlCommand("insert into Table_1 values(mail,contents)values('" + TextBox2.Text.ToString() + "','" + TextBox1.Text.ToString() + "') ", con);
Label1.Text = "投诉已提交.请在2个工作日后,凭您的邮箱地址于查询页面查询投诉处理情况.";
con.Close();
}
点击之后,label是可以显示的,但是数据库里面没有新纪录。求助!!谢谢!!