|
-
Oct 18th, 2007, 03:46 PM
#1
Thread Starter
New Member
Cannot update my database!!!!
I am having a real hard time updating my database with an updated order status changed in a combobox.
I have a sub that calls my update Function based on my combobox text changing. It sends the OrderID (This is the primary key) to the function as intOrderID. My function is below. However I cannot get it to work I keep getting an error:
Private Function UpdateOrderStatus(ByVal intOrderID)
Dim con As New SqlConnection
Dim cmd As SqlCommand = New SqlCommand
Dim intRowsAffected As Integer
con.ConnectionString = My.Settings.TechTrackerConnectionString
cmd.CommandType = CommandType.Text
cmd.CommandText = "UPDATE OrderDetails SET Status = @Status WHERE OrderID = @OrderID"
cmd.Connection = con
cmd.Parameters.Add("@Status", SqlDbType.VarChar, 25, cboMonitorSelectedStatus.Text)
cmd.Parameters.Add("@OrderID", SqlDbType.Int, 4, intOrderID)
con.Open()
intRowsAffected = cmd.ExecuteNonQuery()
MessageBox.Show(intRowsAffected)
con.Close()
End Function
The error I get is this:
The parameterized query '(@Status varchar(25),@OrderID int)UPDATE OrderDetails SET Status' expects the parameter '@Status', which was not supplied.
PLEASE help me with this. I have searched everywhere for an answer and spent about week trying to figure this out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|