C
cagriandac
Hello,
I am creating an application using asp.net 2.0. But I am stuck
somewhere. I want to get values from a DataSet one by one on every
Page_Load. So I wrote my code in Page_Load but it didnt work, giving a
warning. Here is my code:
And the Warning:
Variable 'ds' is used before it has been assigned a value. A null
reference exception could result at runtime.
How can I handle this warning. Did I wrote the code in wrong place?
I created my DataSet using the menu in Visual Web Developer (Visual
Studio 2005). So I did not write any code for it.
Am I assigning the ds right?
I also assigned it as DataSet1TableAdapter. But it didnt work also. I
am a rookie and any help is appreciated.
I am creating an application using asp.net 2.0. But I am stuck
somewhere. I want to get values from a DataSet one by one on every
Page_Load. So I wrote my code in Page_Load but it didnt work, giving a
warning. Here is my code:
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim ds As DataSet1
Dim test As String
test = ds.Tables("pictureID").Rows(0)("pictureID").ToString
Label1.Text = test
End Sub
And the Warning:
Variable 'ds' is used before it has been assigned a value. A null
reference exception could result at runtime.
How can I handle this warning. Did I wrote the code in wrong place?
I created my DataSet using the menu in Visual Web Developer (Visual
Studio 2005). So I did not write any code for it.
Am I assigning the ds right?
I also assigned it as DataSet1TableAdapter. But it didnt work also. I
am a rookie and any help is appreciated.