Dim con As OleDbConnection
Dim ada As OleDbDataAdapter
Dim ds As DataSet
Public Function Patient_Search(ByVal txt As String) As DataSet //txt value is entered by a user in a textbox
ada = New OleDbDataAdapter("Select * from PatientProfile where PatientNo Like @txt or PatientName Like @txt or AdmitDate Like @txt", con)
* ada.SelectCommand.Parameters.Add("@PatientNo", OleDbType.Integer).Value = "%" & txt & "%"
ada.SelectCommand.Parameters.Add("@PatientName", OleDbType.VarChar).Value = "%" & txt & "%"
* ada.SelectCommand.Parameters.Add("@AdmitDate", OleDbType.Date).Value = "%" & txt & "%"
ds = New DataSet
ada.Fill(ds, "PatientProfile")
Return ds
End Function
This is the code i have written inside my form.
In the Parameters.Add lines, the one concerning patient name is allright as it is varchar type and i have used this type in my queries before.
But the problem lies in patient no(int type) and admit date(date type), i am in a fix trying to set parameters for these types.
wud anyone suggest appropriate changes in my code in these two lines (have marked them with an *) so that the int and date type parameters are also set successfully and my query works fine??
This post has been edited by aks29921: 15 September 2009 - 06:52 AM

New Topic/Question
Reply



MultiQuote








|