string constr = "server=localhost;pwd=123;uid=sa;database=kkk";//数据库连接字符串,改成自己的数据库,用户名和密码
SqlConnection con = new SqlConnection(constr);
con.Open();
string sql1 = "INSERT INTO tb_test(Name) VALUES('"+textbox1.Text.Trim()+"')";
SqlCommand sd1 = new SqlCommand(sql1, con);
sd1.ExecuteNonQuery();
con.Close();