Hi,
My error states that I should be declaring @checkBook. I am assuming I am declaring it in [RED] so where's the mistake pls???
Also do I need to use an adapter in here cos I had a search and found this method but I am assuming I need to state my connection somewhere right?? How's that??
Also if someone knows of any good link where I could learn more about parameters please send me link.
many thanks
Code:Private Sub CurrentBalanceShowD() Dim cmd As New SqlCommand Try cmd.Parameters.AddWithValue("@checkBook", SqlDbType.Int).Value = cboBookD.SelectedValue cmd.Parameters.AddWithValue("@checkBook", bookFID) MyConn.Open() 'opening the connection cmd = New SqlCommand("Select stockBalance from tb_bookbalance where bookFID = @checkBook", MyConn) 'executing the command and assigning it to connection txtcurrentD.Text = (cmd.ExecuteScalar()).ToString 'displaying the data from the table MyConn.Close() Catch ex As Exception MsgBox(ex.Message) MyConn.Close() End Try End Sub




Reply With Quote