Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Retrieving Row Elements

Status
Not open for further replies.

spidervenom

Programmer
Mar 8, 2003
19
0
0
US
Hi

Here is a segment of my Code:

.
.
Dim myID As String
myID = Request.QueryString("ID")
Dim intMyID as Integer = Int32.Parse(myID)

Dim getDataSet As Data.DataSet = GetTable()

'Find Row in the DataSet
Dim getDataRow As Data.DataRow = getDataSet.Tables("testTable").Rows.Find(intMyID)

Dim sName, sSubject, sDetails AS String
sName = getDataRow.Item("Name")
sSubject= getDataRow.Item("Subject")
sDetails = getDataRow.Item("Details")
.
.
.

When I compile the code, it gave me an error:

"System.NullReferenceException: Object reference not set to an instance of an object"

How do I solve this problem? Also, is this the right way to retrieve row elements from a table?

Thanks in advance for the help!

 
Try:
Code:
Dim getDataSet As Data.DataSet = New Data.DataSet
getDataSet = GetTable()

'Find Row in the DataSet
Dim getDataRow As Data.DataRow = New Data.DataRow
getDataRow = getDataSet.Tables("testTable").Rows.Find(intMyID)

[morning]
 
I have tired it, it gave me the following errors

Compiler Error Message: BC30390: 'System.Data.DataRow.Protected Sub New(builder As System.Data.DataRowBuilder)' is not accessible in this context because it is 'Protected'.

What is the proper way of fixing it?

Thanks
 
Oops! Sorry about that! Change the following code
Code:
Dim getDataRow As Data.DataRow

[morning]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top