• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

Sql Data Adapter Parameters

How do I pass a parameter with a like statement using a vb.net dataadapter.  When I try the satement below I get the error that Param5 is not a member.  SqlDataAdapter5.SelectCommand.Parameters("@param5").Value = lname

Thanks

SELECT tblPatient.lngPatientId, tblPatient.strLName, tblPatient.strFName, tblPatient.strMName, tblrecordsmanagment.boxnum, tblrecordsmanagment.deptnum, tblrecordsmanagment.dtmarchive, tblrecordsmanagment.strdescription, tblrecordsmanagment.dtmdestroydate, tblrecordsmanagment.ysnboxfull, tblrecordsmanagment.lnglogonid, tblrecordsmanagment.dtmlogondt, tblrecordsmanagment.recordid FROM tblrecordsmanagment INNER JOIN tblPatient ON tblrecordsmanagment.lngPatientid = tblPatient.lngPatientId WHERE (tblPatient.strLName LIKE '@Param5%')
0
running32
Asked:
running32
1 Solution
 
JRossi1Commented:
Are you using a stored procedure?
0
 
maidinhtaiCommented:
Try this:
sqlDataAdapter.SelectCommand.CommandText = "SELECT tblPatient.lngPatientId, tblPatient.strLName, tblPatient.strFName, tblPatient.strMName, tblrecordsmanagment.boxnum, tblrecordsmanagment.deptnum, tblrecordsmanagment.dtmarchive, tblrecordsmanagment.strdescription, tblrecordsmanagment.dtmdestroydate, tblrecordsmanagment.ysnboxfull, tblrecordsmanagment.lnglogonid, tblrecordsmanagment.dtmlogondt, tblrecordsmanagment.recordid FROM tblrecordsmanagment INNER JOIN tblPatient ON tblrecordsmanagment.lngPatientid = tblPatient.lngPatientId WHERE (tblPatient.strLName LIKE '" & lname & "')"
0
 
running32Author Commented:
Thank you
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now