I am trying to assign a asp.net label the value of a datareader return. I am doing "Select (column) from table" and trying to set the label text equal to it, with no luck at all.<BR><BR>when i do this<BR> Balance.Text = MyReader.getstring(0).tostring()<BR>it says 'System.InvalidOperationException: Invalid attempt to read when no data is present'<BR><BR>when i do response.write <BR> it says 'System.InvalidCastException: Specified cast is not valid' any suggestions<BR><BR><BR><BR>You need to populate the reader first with something like<BR><BR>MyReader.Read()<BR><BR>Dim MyConnection As SqlConnection<BR> Dim sqlStr As String <BR> Dim strConn As String = "server=localhost;uid=mdg3796; pwd=08261978;database=financials"<BR> Dim MyString as String<BR> Dim test<BR><BR> sqlStr = "Select Sum(financial_cost) From financial"<BR><BR> 'Open up our connection with our connection object<BR> MyConnection = New SQLConnection(strConn)<BR><BR> 'To execute our Sql Statement and provide out active connection<BR>Dim MyCommand As New SqlCommand(sqlStr, MyConnection)<BR><BR>'Open<BR>MyCommand.Connection.Open()<BR><BR>Dim MyReader As SqlDataReader = MyCommand.ExecuteReader(CommandBehavior.CloseConne ction)<BR><BR>While MyReader.read <BR> if not MyReader.isdbnull(0) then <BR>'get error with .tostring or without it<BR> response.write(MyReader.getstring(0).tostring)<BR> End if <BR>End While <BR>'get error here as well<BR> Balance.Text = MyReader.getstring(0).tostring()