Select statement

Discussion in 'ASP .Net' started by VJ, Mar 30, 2006.

  1. VJ

    VJ Guest

    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?

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
    VJ, Mar 30, 2006
    #1
    1. Advertising

  2. VJ

    sirfunusa Guest

    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?
    sirfunusa, Mar 30, 2006
    #2
    1. Advertising

  3. Show some snippet code and you will get an answer
    Patrick

    "VJ" <> wrote in message
    news:...
    > 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?
    >
    > --
    > Sent via .NET Newsgroups
    > http://www.dotnetnewsgroups.com
    Patrick.O.Ige, Mar 31, 2006
    #3
  4. VJ

    Guest

    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
    , Apr 1, 2006
    #4
  5. 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
    <> wrote in message
    news:...
    > 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
    >
    Patrick.O.Ige, Apr 1, 2006
    #5
  6. VJ

    sirfunusa Guest

    Sorry, can't help you if you don't answer my original questions.
    sirfunusa, Apr 3, 2006
    #6
  7. VJ

    Guest

    You can't use an expression in the select statement

    you'll have to take out the "+" signs
    , Apr 3, 2006
    #7
  8. VJ

    Guest

    er, you can't use an expression in the declarative property of the
    sqldatasource i mean
    , Apr 3, 2006
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    800
  2. Jay McGavren
    Replies:
    11
    Views:
    1,127
    Alan Krueger
    Jan 16, 2006
  3. tedsuzman
    Replies:
    2
    Views:
    7,076
    Michel Claveau, résurectionné d'outre-bombe inform
    Jul 21, 2004
  4. Ted
    Replies:
    1
    Views:
    460
    Duncan Booth
    Jul 22, 2004
  5. palmiere
    Replies:
    1
    Views:
    396
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page