In the Page_Load event of web form, I create a DataSet and fill up by a
DataAdapter. Then I can retrieve data by the following command :
ds1.Tables(0).Rows(0).Item("accno")
However, when I issue the same command in DataGrid1_SelectedIndexChanged,
error occurs, Tables(0) cannot be reference. How can I fix it? Thanks.

Re: cannot refer to data table by Karl

Karl
Thu Aug 19 11:52:03 CDT 2004

Your dataset will need to get repopulated on postback if you want to access
it (or store it in a viewstate *shrug*)...

Karl

"Joe Au" <joeau@livingfaith.org.hk> wrote in message
news:OEcp8dghEHA.2052@tk2msftngp13.phx.gbl...
> In the Page_Load event of web form, I create a DataSet and fill up by a
> DataAdapter. Then I can retrieve data by the following command :
> ds1.Tables(0).Rows(0).Item("accno")
> However, when I issue the same command in DataGrid1_SelectedIndexChanged,
> error occurs, Tables(0) cannot be reference. How can I fix it? Thanks.
>
>



Re: cannot refer to data table by Miha

Miha
Thu Aug 19 16:26:11 CDT 2004

Where do you store the dataset?
How do you reference it from within the event?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Joe Au" <joeau@livingfaith.org.hk> wrote in message
news:OEcp8dghEHA.2052@tk2msftngp13.phx.gbl...
> In the Page_Load event of web form, I create a DataSet and fill up by a
> DataAdapter. Then I can retrieve data by the following command :
> ds1.Tables(0).Rows(0).Item("accno")
> However, when I issue the same command in DataGrid1_SelectedIndexChanged,
> error occurs, Tables(0) cannot be reference. How can I fix it? Thanks.
>
>