donkiely:Does the array always hold three values? If so, something like this will work:
SELECT * FROM table WHERE Name = @Name1 OR Name = @Name2 OR Name = @Name3
Use that statement to build a SqlCommand object, pass in the values of the array as th3 @Name1, @Name2, and @Name3 parameters, and make the call.
Will that work for you? If not, provide more details.
Don
Thanks for the help.
But my actual query is not i mentioned above...That I gave just to make problem simplified but i think i should provide
details.
here is my code: // I Have avoided to write un-necessary statements here
SelectCommand="SELECT
jobs.Job_title,Company,Location,Details,Code,Candidate,Minexp,Date FROM
jobs where [Job_title]Like '%' +@Job_title+'%' and [Minexp]>=@Minexp
"
<SelectParameters>
<asp:SessionParameter SessionField="txtsearch" Name="Job_title" />
<asp:SessionParameter SessionField="txtmin" Name="Minexp" Type="Int32" />
</SelectParameters>
_____________________ _______________________________________________________________________
it works fine......but I have one more session variable called Session("txtlocation") which holds multiple values ( values selected from list box) . I am using string array in my page's load event to copy all values from
Session("txtlocation")
Dim str() As String = CType(Session("ListBoxValues"), String())
I want to use Session("txtlocation") in <asp:SessionParameter ......> just like I used above session variables
1 ] <asp:SessionParameter SessionField="txtlocation" Name="txtloc"> will be the right format ?
2] Also, i want to write in sql query to match location specified by user to any location which Session("txtlocation")
holds . How will the query be ?
where
[Location] like '%' +@txtloc+'%' //but then how to specify multiple
values of location which Session("txtlocation") holds???
_____________________ _______________________________________________________________________
In short, this query not working..something wrong about array i used below..
SelectCommand="SELECT ------ FROM ----- where [Location]Like '%' +@loc[0]+'%' "
I have one solution in mind....Since there are fix number of values in list, i can copy them in string variable
suppose we copy first value in str variable then the query will be? where [location] like ' "&str&"' ??
is this syntax correct ??