filtering data

V

vncntj

the problem i'm having is that i can't get the Sql statement set to
search for Department or Last_Name%..
:(


<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:dbPMAEventsConnectionString %>"
SelectCommand="SELECT [Last_Name], [First_Name], [Title],
[Extension], [Email_Address], [Department] FROM [qryEntire_List] WHERE
(([Department_ID] = @Department_ID) OR ([Last_Name] = @Last_Name%))">
<SelectParameters>
<asp:ControlParameter ControlID="lastnameTextbox"
Name="Last_Name" PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
 
S

S. Justin Gengo [MCP]

What are the results you do get? Is there an error or just no results
returned. Does it search department correctly and not last name correctly?
The first thing I would do is write your query as a stored procedure. Get
that working and then just send the stored proc. the parameters. It's much
more efficient and easier to debug. The first thing I'd question is that you
may not be able to use the percent sign right after the parameter in your
query. But I'm not certain about that. The second thing (this one for sure)
is that when you use the percent sign you shouldn't use the equals sign you
should use "LIKE".

OR ([Last_Name] LIKE @Last_Name%))">


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top