资 源 简 介
本资源为连接数据库的基本操作,
private void button3_Click(object sender, EventArgs e)
{
string user = textBox1.Text;
string pwd = textBox2.Text;
string code = textBox3.Text;
//创建数据库连接类的对象
SqlConnection con = new SqlConnection("server=FSMOOTH-PC;database=zxl;user=sa;pwd=fsmooth19841019");
con.Open();
//执行con对象的函数,返回一个SqlCommand类型的对象
SqlCommand cmd = con.CreateCommand();
//拼写语句
cmd.CommandText = "update users set name="" + user + "",pwd="" + pwd + "" where code="