can we assign a data column value to a variable and use this variable in different method.
i have the following code
button_click()
{
create and fill data set as data adapter.fill(data set,"ABC");
and then
int x= data set.tables["ABC"].rows[0]["col name"] ;
}
and i have another method button_click2()
{
int y = x;
}
can i do this? or is there any way i can assign the data set.tables[“ABC”].rows[0][“col name”] value directly to x
If you create the variable out side the method you will be able to use it anywhere within the class.
Please see user608576 answer about storing values in Viewstate if you are using Asp.net.