Continuing on from my adding data to the db I am using the following to try and update the db

End If
                        'Refresh_Form()
                        conn.Close()

                        'update property table
                        Dim connUpString As String = My.Settings.strConn
                        Dim connUp As New SqlConnection(connUpString)
                        Dim cmdUp As New SqlCommand

                        Try
                            connUp.Open()
                            cmdUp.Connection = connUp
                            cmdUp.CommandText = "UPDATE property SET available = @available WHERE propRef = @propRef, cmdUp"
                            cmdUp.Parameters.AddWithValue("@available", False)
                            cmdUp.Parameters.AddWithValue("@propRef", Me.DropDownList1.Text)
                            Dim ok As Integer = cmdUp.ExecuteNonQuery()

                        Catch ex As Exception
                            MessageBox.Show("Error while updating record on table..." & ex.Message, "Update Records")
                        Finally
                            connUp.Close()
                        End Try

                    End If

                Catch ex As Exception
                    MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
                End Try
            End If
        End If

I get error while updating record on table...Incorrect syntax near ','.
?

I can't see where it is getting this from? the the dropdownlist.text ="RC1"

ok I think I have it

'update property table
                Dim connUpString As String = My.Settings.strConn
                Dim connUp As New SqlConnection(connUpString)
                Try
                    connUp.Open()
                    Dim updateSql As String = "UPDATE property " & "SET available = @available " & "WHERE propRef = @propRef"
                    Dim cmdUp As New SqlCommand(updateSql, connUp)

                    cmdUp.Parameters.Add("@available", SqlDbType.Bit, 0)
                    cmdUp.Parameters.Add("@propRef", SqlDbType.VarChar, 10, "propRef")
                    cmdUp.Parameters("@available").Value = 0
                    cmdUp.Parameters("@propRef").Value = Me.RadDropDownList1.Text
                    cmdUp.ExecuteNonQuery()



                Catch ex As SqlException
                    MessageBox.Show("Error while updating record on table..." & ex.Message, "Update Records")
                Finally
                    connUp.Close()
                End Try

If it works, then mark thread as solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.