Idatareaders not returning values from database
- by Phil
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.