I'm trying to add some data to my database using this code
SqlCommand cmd = new SqlCommand("sp_insertDelivery", conn);
cmd.CommandType =
CommandType.StoredProcedure;cmd.Parameters.AddWithValue(
"@SlotID", "1");cmd.Parameters.AddWithValue(
"@CustID", textBoxCustNo.Text);cmd.Parameters.AddWithValue(
"DeliveryDate", dateTimePicker1.Value.Date.ToShortDateString());cmd.Parameters.AddWithValue(
"Chilled", textBoxChilled.Text);cmd.Parameters.AddWithValue(
"Frozen", textBoxFrozen.Text);cmd.Parameters.AddWithValue(
"Ambient", textBoxAmbient.Text);cmd.Parameters.AddWithValue(
"OrderDate", System.DateTime.Now);cmd.Parameters.AddWithValue(
"Notes", textBoxNotes.Text);cmd.Connection.Open();
try{
int i = 0;i = cmd.ExecuteNonQuery();
if (i >= 1){
toolStripStatusLabel1.Text =
"Customer order has been made";}
else{
toolStripStatusLabel1.Text =
"error";}
}
The weird thing is that it says that data has been added successfully but when I check to see if it is there then it hasn't added it.
I can add data manually so I don't think there is anything wrong with the permissions.
Any help would be great. PS This is ado.net 2.0

Andrzej WegierskiRank #1,729 · 877 reputationPosted Jul 17, 2005, 11:33 PM EDT