G
Guest
Hi
I have wrote a stored proc (Sproc) to update one of my sqlserver tables. This is what the query looks like
ALTER PROCEDURE dbo.UpdMea
(@NewName nvarchar(50)
@NewCost Money
@MealType varchar(50)
AS UPDATE dbo.Men
SET Meal_Type = @NewName, Meal_Cost = @NewCos
WHERE (Meal_Type = @MealType
I have a combobox that contains a list of meals. When the value is changed a sproc is fired aginst my DB that retrieve the Meal Name and Price based on what is selected in the combobox. The results of this query are then binded to 2 textboxes. The user can then update the values in the textboxes and click the Save button to propogate the changes back to the database
The problem i have is the changes do not seem to appear in my database and no message is displayed showing me a possible error. Can anyone see if i am missing anything in the onclick event code for my save button.....
If MsgBox("Are you sure you want to save your updates?", MsgBoxStyle.OKCancel Or MsgBoxStyle.Question, "Save?") = MsgBoxResult.OK The
Dim cmdUpdMeal As New SqlCommand("UpdMeal", Conn
cmdUpdMeal.CommandType = CommandType.StoredProcedur
cmdUpdMeal.Parameters.Add("@NewName", TextBox1.Text
cmdUpdMeal.Parameters.Add("@NewCost", Convert.ToDecimal(TextBox2.Text)
cmdUpdMeal.Parameters.Add("@MealType",
CBoxEditMealName.SelectedText.ToString
Tr
Conn.Open(
cmdUpdMeal.ExecuteNonQuery(
Catch x As Exceptio
MsgBox(x.Message
Finall
Conn.Close(
End Tr
End If
I have wrote a stored proc (Sproc) to update one of my sqlserver tables. This is what the query looks like
ALTER PROCEDURE dbo.UpdMea
(@NewName nvarchar(50)
@NewCost Money
@MealType varchar(50)
AS UPDATE dbo.Men
SET Meal_Type = @NewName, Meal_Cost = @NewCos
WHERE (Meal_Type = @MealType
I have a combobox that contains a list of meals. When the value is changed a sproc is fired aginst my DB that retrieve the Meal Name and Price based on what is selected in the combobox. The results of this query are then binded to 2 textboxes. The user can then update the values in the textboxes and click the Save button to propogate the changes back to the database
The problem i have is the changes do not seem to appear in my database and no message is displayed showing me a possible error. Can anyone see if i am missing anything in the onclick event code for my save button.....
If MsgBox("Are you sure you want to save your updates?", MsgBoxStyle.OKCancel Or MsgBoxStyle.Question, "Save?") = MsgBoxResult.OK The
Dim cmdUpdMeal As New SqlCommand("UpdMeal", Conn
cmdUpdMeal.CommandType = CommandType.StoredProcedur
cmdUpdMeal.Parameters.Add("@NewName", TextBox1.Text
cmdUpdMeal.Parameters.Add("@NewCost", Convert.ToDecimal(TextBox2.Text)
cmdUpdMeal.Parameters.Add("@MealType",
CBoxEditMealName.SelectedText.ToString
Tr
Conn.Open(
cmdUpdMeal.ExecuteNonQuery(
Catch x As Exceptio
MsgBox(x.Message
Finall
Conn.Close(
End Tr
End If