点击Button将数据保存到新建的数据库表中可以提供一下思路吗?谢谢
展开全部
protected void Button1_Click(object sender, EventArgs e)
{
string name = job_name.Text;
string address = job_address.Text;
string telephone = job_telephone.Text;
MySqlConnection conn = new MySqlConnection("数据库连接");
conn.Open();
MySqlCommand cmd = new MySqlCommand("", conn);
cmd.CommandText = "insert into HY_GRXX (job_name,job_address,job_telephone) value ('" + name + "','" + address + "','" + telephone + "')";
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
Response.Write("<script>alert('提示信息:操作成功!');</script>");
}
conn.Close();
}
{
string name = job_name.Text;
string address = job_address.Text;
string telephone = job_telephone.Text;
MySqlConnection conn = new MySqlConnection("数据库连接");
conn.Open();
MySqlCommand cmd = new MySqlCommand("", conn);
cmd.CommandText = "insert into HY_GRXX (job_name,job_address,job_telephone) value ('" + name + "','" + address + "','" + telephone + "')";
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
Response.Write("<script>alert('提示信息:操作成功!');</script>");
}
conn.Close();
}
更多追问追答
追问
您好 可以留个QQ吗? 请教您一下
追答
有什么问题你尽管问吧,我不怎么使用qq
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询