Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

working with datalist

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
I have the following SQL statement for a datalist

Dim selectCMD As SqlCommand = New SqlCommand("Select lastName, lastName + ',' + firstName As firstAndlast, phonenumber, location from phonelist where location = '4th Floor' Order by firstAndlast", dbconn)

Which I try too show in my datalist like this. <%# Container.DataItem( &quot;firstAndlast&quot; ) %> but I am getting the following error

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: firstAndlast


How can I fix this?
 
Sounds possibly like an empty set of data ??

or if you're sure that sql returns data, then make sure you have your datasource set on the datalist properly?

Just a couple shots in the dark...

> code == > help

:)
paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top