Click to See Complete Forum and Search --> : conversion from string


claudecalleja
04-28-2006, 03:14 AM
I have implemented a stored procedure that implements a search, that should work. However, I have this code in the Search button, that is meant to send any combination of these 4 parametres. However, it's giving me an error

"conversion from string "" to type 'integer' is not valid"

I'm sure it's a stupid mistake of mine, but I cant seem to find the problem and hence the solution.

Private Sub Search_Patient_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Search_Patient.Click

Dim ID_No, Name, Surname As String
Dim Patient_No As Integer

ID_No = ""
Patient_No = 0
Name = ""
Surname = ""

ID_No = ID_No_TextBox.text
Patient_No = (CType(Patient_No_TextBox.Text, Integer))
Name = Name_TextBox.Text
Surname = Surname_TextBox.Text

Try
Me.PatientTableAdapter.FillBy(Me.DatabaseDataSet.Patient, ID_No, Patient_No, Name, Surname)
MessageBox.Show("Retrieving Patient Data Complete")
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
MessageBox.Show("Error retrieving Patient Data")
End Try
End Sub


Can anyone please help? Thanks

claudecalleja
04-28-2006, 08:05 AM
solved!! I just had a mismatch with the stored procedure