Displaying records in a datagrid

N

.Net Sports

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
 

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,774
Messages
2,569,596
Members
45,141
Latest member
BlissKeto
Top