Idatareaders not returning values from database
Posted
by Phil
on Stack Overflow
See other posts from Stack Overflow
or by Phil
Published on 2010-05-25T12:17:35Z
Indexed on
2010/05/25
12:21 UTC
Read the original article
Hit count: 236
In my codebehind I have this vb:
Dim reader as idatareader = includes.SelectDepartmentID(PageID)
While reader.Read
Did = reader("departmentid")
GroupingHeading = reader("heading")
Folder = reader("folder")
If reader("OwnBanner") Is DBNull.Value Then
OwnBanner = String.Empty
Else
OwnBanner = reader("ownbanner")
End If
Then in my class I have:
Public Function SelectDepartmentID(ByVal PageID As Integer) As IDataReader
Dim Command As SqlCommand = db.GetSqlStringCommand("sql")
db.AddInParameter(Command, "@pageid", Data.DbType.Int32, PageID)
Dim reader As IDataReader = db.ExecuteReader(Command)
reader.Read()
Return reader
End Function
No Errors are being presented yet nothing is being returned by the reader. Is there an error in my code?
Thanks.
© Stack Overflow or respective owner