ASP.NET BasePage dataset type is not defined
I'm am creating an ASP.NET 2.0 web application that uses a BasePage.aspx that is inherited by all other .aspx pages. I have designed a dataset with 3 stored procedures in it called dsBaseInfo. I declare it as a privat开发者_开发知识库e member of the class and when I go to run the application it tells me the dsBaseInfo type is not defined. I also tried just a Dataset instead of my dsBaseInfo and I get the same error, type not defined. I have tried Private dsBase as dsBaseInfo, Private dsBase as dsBaseInfo = nothing, Private dsBase as new dsBaseInfo, Private dsBase as Dataset, and so on. I even tried moving declaration to the PreInit sub and same error. I have also done the Private dsBAse as dsBaseInfo in a .aspx that inherits the BasePage and it works on that page.
Imports System
Imports System.Web.UI
Imports System.Data.SqlClient
Public Class BasePage
Inherits System.Web.UI.Page
Private dsBase As dsBaseInfo = Nothing 'dataset
Private _userInfo As UserInfo
Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
If User.Identity.IsAuthenticated Then
_userInfo = New UserInfo
If dsBase Is Nothing Then
If Session("BaseInfo") Is Nothing Then
dsBase = New dsBaseInfo
RetrieveBaseInfo(dsBase)
Session("BaseInfo") = dsBase
Else
dsBase = TryCast(Session("BaseInfo"), dsBaseInfo)
End If
End If
End If
End Sub
Private Sub RetrieveBaseInfo(ByVal dsBase As dsBaseInfo)
Using da As New dsBaseInfoTableAdapters.ssp_GetUserBaseInfoTableAdapter
da.Fill(dsBase.ssp_GetUserBaseInfo, User.Identity.Name)
End Using
Dim intID As Integer = dsBase.ssp_GetUserBaseInfo.Rows(0)(dsBase.ssp_GetUserBaseInfo.IDColumn.ColumnName)
Using da As New dsBaseInfoTableAdapters.ssp_GetCompaniesTableAdapter
da.Fill(dsBase.ssp_GetCompanies, intID)
End Using
Using da As New dsBaseInfoTableAdapters.ssp_GetMasterMenuListTableAdapter
da.Fill(dsBase.ssp_GetMasterMenuList, intID)
End Using
End Sub
End Class
Do both pages include Imports System.Data
at the top of the file? (I don't see it in the supplied code.) DataSet
is in that namespace, so you'll need to import that namespace in order to reference the class without fully-qualifying it.
精彩评论