Displaying records in a datagrid

Discussion in 'ASP .Net Web Controls' started by .Net Sports, May 16, 2005.

  1. .Net Sports

    .Net Sports Guest

    I'm able to display the lname and fname variables in my datagrid ,
    using the below sql string


    strSQLQuery = "SELECT fname + ' ' + lname AS Name, cust_id " _
    & "FROM tblcusttag " _
    & "WHERE lname LIKE '%" & Replace
    (strSearch, "'", "''") _
    & "%' " _
    & "AND fname LIKE '%" & strSearch2 _
    & "%' " _
    & "ORDER BY lname;"


    users enter both a first name and last name in 2 text boxes. In another

    script with the sql string:


    strSQLQuery = "SELECT fname + ' ' + lname AS Name, phoneNum, cust_id "
    _
    & "FROM tblcusttag " _
    "WHERE phoneNum LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
    & "ORDER BY lname;"


    and only using an input box for the users to enter a phone number to
    query, I do not see the Name (or lname nor fname) in the Datagrid
    display:


    <asp:DataGrid id="dgCustName" runat="server"
    Headerstyle-BackColor="#48546a­"
    Headerstyle-ForeColor="#c0c0c0­"
    Headerstyle-Font-Name="Arial"
    Headerstyle-Font-Size="14"
    Headerstyle-Font-Bold="true"
    />


    <columns>


    <asp:BoundColumn
    DataField="cust_id"
    HeaderText="Customer ID"
    ReadOnly="true">
    </asp:BoundColumn>


    <asp:BoundColumn
    DataField="Lname"
    HeaderText="Last Name">
    </asp:BoundColumn>


    <asp:BoundColumn
    DataField="Fname"
    HeaderText="First Name">
    </asp:BoundColumn>


    <asp:BoundColumn
    DataField="phoneNum"
    HeaderText="Phone #">
    </asp:BoundColumn>
    </columns>


    </asp:DataGrid>


    The datagrid is configured the same exact way for the
    firstName/lastname script; both customer ids are displayed in each of
    the datagrids
    TIA
    ..netSports
    .Net Sports, May 16, 2005
    #1
    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. Lisa Calla

    displaying records with many fields

    Lisa Calla, Oct 8, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    457
    Lisa Calla
    Oct 10, 2005
  2. Mohammed Mazid
    Replies:
    4
    Views:
    582
    steve souza
    Nov 30, 2003
  3. Luke Airig
    Replies:
    0
    Views:
    787
    Luke Airig
    Dec 31, 2003
  4. Dan

    Delete records or update records

    Dan, May 10, 2004, in forum: ASP General
    Replies:
    1
    Views:
    461
    Ray at
    May 10, 2004
  5. Replies:
    3
    Views:
    656
    Anthony Jones
    Nov 2, 2006
Loading...

Share This Page