Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Save()
- {
- string sql = "INSERT INTO orders"
- + "(uid"
- + ",uname"
- + ",email"
- + ",phone"
- + ",ordernum"
- + ",goods"
- + ",cost"
- + ",count"
- + ",coupon)"
- + "VALUES"
- + "(@uid"
- + ",@uname"
- + ",@email"
- + ",@phone"
- + ",@ordernum"
- + ",@goods"
- + ",@cost"
- + ",@count"
- + ",@coupon)";
- try
- {
- SqlCommand command = new SqlCommand();
- command.Connection = connect;
- command.CommandType = CommandType.Text;
- command.CommandText = sql;
- command.Parameters.AddWithValue("@uid", tb_uid.Text);
- command.Parameters.AddWithValue("@uname", ???????);
- command.Parameters.AddWithValue("@email", tb_email.Text);
- command.Parameters.AddWithValue("@phone", tb_phone.Text);
- command.Parameters.AddWithValue("@ordernum", tb_ordernum.Text);
- command.Parameters.AddWithValue("@goods", tb_goods.Text);
- command.Parameters.AddWithValue("@cost", tb_cost.Text);
- command.Parameters.AddWithValue("@count", tb_count.Text);
- command.Parameters.AddWithValue("@coupon", tb_coupon.Text);
- connect.Open();
- command.ExecuteNonQuery();
- // MessageBox.Show("Succes!");
- }
- catch (SqlException a)
- {
- Console.WriteLine(a);
- }
- finally
- {
- connect.Close();
- View();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement