How Could I Pass Parameter To Sqldataadapter?
I have tried to pass parameter a value, but what it returns is nothing. If I use a simple sql command without parameter I can retrieve all the data from my database. Here is my cod
Solution 1:
You are searching the string @criteria, you want to use the parameter, so use:
sql = "SELECT DEP_ID AS CODE, DEP_NAME AS DEPARTMENT FROM DEPART_TBL WHERE " & FieldName & " LIKE N'%' + @criteria + '%'"or you can use it in the parameter:
da.SelectCommand.Parameters("@criteria").Value = "%KCL%"
Post a Comment for "How Could I Pass Parameter To Sqldataadapter?"