chrismid259
Member
- Joined
- Feb 9, 2011
- Messages
- 6
- Programming Experience
- Beginner
Hi all,
I've recently come across a problem with my VB application which is throwing up an error; OleDbException was unhandled. It says "No value given for one or more required parameters."
Hopefully someone will be able to help me here.
Thanks in advance.
I've recently come across a problem with my VB application which is throwing up an error; OleDbException was unhandled. It says "No value given for one or more required parameters."
I've highlighted the error is red. The error occurs when I select a station from each combo box and then hit the "Calculate" button which should pull the price from the database and display it in the price label.Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
'Try
Dim con As New OleDbConnection(conStr)
sqlStr = "SELECT Price FROM ticketprices WHERE To = '" & cmbTo.Text & "'"
Dim cmd As New OleDbCommand(sqlStr, con)
con.Open()
Dim rdr As OleDbDataReader = cmd.ExecuteReader()
While rdr.Read
lblPrice.Text = CStr(rdr("Price"))
End While
con.Close()
Catch ex As Exception
MsgBox(ex.StackTrace)
End Try
End Sub
Hopefully someone will be able to help me here.
Thanks in advance.