D
DC Gringo
I'm trying to use a label control to show the # of records in my datagrid
and think I'm stuck on something simple...please help:
Error is: Name 'myDataSet1' is not declared.
FYI, it works fine if I use an integer value like "100" rather than
myDataSet1.Tables("CommunitiesT1")
-----MY LABEL CONTROL------
<asp:Label ID="lblRecordCount" runat="server" text="<%# RecordCount %>" />
------MY PROPERTY-----
ReadOnly Property RecordCount() as Integer
Get
Dim intRecordCount As Integer
intRecordCount = myDataSet1.Tables("CommunitiesT1")
Return intRecordCount
End Get
End Property
-----My SUB PAGE_LOAD------
Sub Page_Load(Source As Object, E As EventArgs)
If Not Page.IsPostBack Then
BindData()
End If
End Sub
-----My DATA ACCESS CODE-----
Sub BindData()
Dim conString As String =
"server=server;database=db;uid=user;pwd=pwd;"
Dim myDataSet1 As New DataSet
Dim myDataAdapter1 As New SqlDataAdapter(_sqlStmt, conString)
myDataAdapter1.Fill(myDataSet1, "CommunitiesT1")
DataGrid2.DataSource = myDataSet1.Tables("CommunitiesT1")
DataGrid2.DataBind()
lblRecordCount.DataBind()
End Sub
and think I'm stuck on something simple...please help:
Error is: Name 'myDataSet1' is not declared.
FYI, it works fine if I use an integer value like "100" rather than
myDataSet1.Tables("CommunitiesT1")
-----MY LABEL CONTROL------
<asp:Label ID="lblRecordCount" runat="server" text="<%# RecordCount %>" />
------MY PROPERTY-----
ReadOnly Property RecordCount() as Integer
Get
Dim intRecordCount As Integer
intRecordCount = myDataSet1.Tables("CommunitiesT1")
Return intRecordCount
End Get
End Property
-----My SUB PAGE_LOAD------
Sub Page_Load(Source As Object, E As EventArgs)
If Not Page.IsPostBack Then
BindData()
End If
End Sub
-----My DATA ACCESS CODE-----
Sub BindData()
Dim conString As String =
"server=server;database=db;uid=user;pwd=pwd;"
Dim myDataSet1 As New DataSet
Dim myDataAdapter1 As New SqlDataAdapter(_sqlStmt, conString)
myDataAdapter1.Fill(myDataSet1, "CommunitiesT1")
DataGrid2.DataSource = myDataSet1.Tables("CommunitiesT1")
DataGrid2.DataBind()
lblRecordCount.DataBind()
End Sub