Select statement

V

VJ

SELECT [Department], [Last_Name], [First_Name], [Title], [Extension]
FROM [temployees] WHERE (([Department] = @Department) OR ([First_Name]
LIKE '%' + @First_Name + '%'))

this is my sql statement on my GridView but I can't get the values to
display?
 
S

sirfunusa

Are you getting an error? Do other sql statements on other gridviews
work? How are you passing in those parameters? Do hard-coded sql
statements work?
 
V

vncntj

This is my sqldatasource.....

<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:dbPMAEventsConnectionString %>"
SelectCommand="SELECT [Department], [Last_Name], [First_Name],
[Title], [Extension] FROM [temployees] WHERE (([Department] =
@Department) OR ([First_Name] LIKE '%' + @First_Name + '%'))">
<SelectParameters>
<asp:ControlParameter ControlID="dpdDepartment"
Name="Department" PropertyName="SelectedValue"
Type="String" />
<asp:FormParameter FormField="txtFirstName"
Name="First_Name" Type="String" />
</SelectParameters>
</asp:SqlDataSource>


but the gridview gives me NO data at all

<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataSourceID="SqlDataSource2"
Font-Names="Arial" Font-Size="Smaller" Style="z-index: 109;
left: 140px; position: absolute;
top: 314px" Width="800px">

thanks
v
 
P

Patrick.O.Ige

Have you tried your SQL statement using Query Analyzer?
Pls do that and is it possible to move your Sql statement to a stored
procedure
PAtrick
 
N

neilmcguigan

You can't use an expression in the select statement

you'll have to take out the "+" signs
 
N

neilmcguigan

er, you can't use an expression in the declarative property of the
sqldatasource i mean
 

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

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top