protected void btnadd_Click(object sender, EventArgs e)
{
if (TextBox1.Text !="" )
{
SqlConnection con = new SqlConnection("server=.;database=shunshun;uid=sa;pwd=zbs;");
con.Open();
string sqlStr = "insert into class values(1,'" + TextBox1.Text + "')";
SqlCommand cmd = new SqlCommand(sqlStr, con);
if (cmd.ExecuteNonQuery() > 0)
{
Response.Write("添加成功!");
}
else
{
Response.Write("添加失败!");
}
con.Close();
}
else
{
Response.Write("内容不能为空!");
}
}
}