private void button1_Click_1(object sender, EventArgs e)
{
MySqlConnection con = new MySqlConnection(MyConString);
con.Close();
con.Open();
string m = "INSERT INTO Tools (TCode,TName,Description,
Classification,Model,Capacity,Status,Quantity,
Avaiability,DatePurchased,DateDelivered)
VALUES (@TCode,@TName,@Description,
@Classification,@Model,@Capacity,@Status,@Quantity,
@Avaiability,@DatePurchased,@DateDelivered)";
MySqlCommand cmd = new MySqlCommand(m, con);
cmd.Parameters.Add("@TCode", MySqlDbType.VarChar).Value = txtCode.Text;
cmd.Parameters.Add("@TName", MySqlDbType.VarChar).Value = txtName.Text;
cmd.Parameters.Add("@Description", MySqlDbType.VarChar).Value = txtDesc.Text;
cmd.Parameters.Add("@Classification", MySqlDbType.VarChar).Value = txtClass.Text;
cmd.Parameters.Add("@Model", MySqlDbType.VarChar).Value = txtModel.Text;
cmd.Parameters.Add("@Capacity", MySqlDbType.VarChar).Value = txtCapacity.Text;
cmd.Parameters.Add("@Status", MySqlDbType.VarChar).Value = txtStat.Text;
cmd.Parameters.Add("@Quantity", MySqlDbType.VarChar).Value = txtQuantity.Text;
cmd.Parameters.Add("@Availability", MySqlDbType.VarChar).Value = ttAvail.Text;
cmd.Parameters.Add("@DatePurchased", MySqlDbType.VarChar).Value = txtDP.Text;
cmd.Parameters.Add("@DateDelivered", MySqlDbType.VarChar).Value = txtDD.Text;
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Successful!", "Message");
}
问问题
2079 次