Sql = "连接数据库";
SqlConnection cn = new SqlConnection(sql);
cn.Open();
string str = "insert into 表名(字段名...逗号隔开) values('" + TextBox1.Text + "','" + TextBox2.Text + "')";
SqlCommand cmd = new SqlCommand(str, cn);
cmd.ExecuteNonQuery();
cn.Close();
SqlConnection cn = new SqlConnection(sql);
cn.Open();
string str = "insert into 表名(字段名...逗号隔开) values('" + TextBox1.Text + "','" + TextBox2.Text + "')";
SqlCommand cmd = new SqlCommand(str, cn);
cmd.ExecuteNonQuery();
cn.Close();
SqlConnection cn = new SqlConnection(sql);
cn.Open();
string str = "insert into 表名(字段1,字段2,字段3...) values('" + TextBox1.Text + "','" + TextBox2.Text + "')";
SqlCommand cmd = new SqlCommand(str, cn);
cmd.ExecuteNonQuery();
cn.Close();
SqlConnection cn = new SqlConnection(sql);
cn.Open();
string str = "insert into 表名(字段1,字段2,字段3,...) values('" + TextBox1.Text + "','" + TextBox2.Text + "','你要添加的数据值',...)";
SqlCommand cmd = new SqlCommand(str, cn);
cmd.ExecuteNonQuery();
cn.Close();