Hi
My SQL code does the following select
As you can see I am then renaming the dataset table to "DataMembers"
Now further one in my code, I want to loop through the dataset table "DataMembers" one row at a time. The code that I am using is:
The problem that I am getting is: Object reference not set to an instance of an object.
This errors is thrown for the first line of the for loop.
Any suggestions??
Mike55
My SQL code does the following select
Code:
MyCommand.CommandType = CommandType.Text
MyCommand.CommandText = "SELECT DISTINCT myMembers.Member_ID, myMembers.Surname, myMembers.Forename, " & _
"myGroups.Group_Name, myGroups.Group_ID, myGroups.Group_Description " & _
"FROM myMembers " & _
" CROSS JOIN myGroupMembership " & _
"INNER JOIN myGroupMembership myGroupMembership_1 " & _
"ON myGroupMembership.Member_ID = myMembers.Member_ID " & _
"INNER JOIN myGroups " & _
"ON myGroups.Group_ID = myGroupMembership.Group_ID " & _
"ORDER BY myMembers.Member_ID"
daDataAdapter.SelectCommand = MyCommand
daDataAdapter.Fill(dsDataset)
daDataAdapter.Dispose()
3. Retrieve the data and place it in a datagrid.
GridEX1.DataSource = dsDataset.Tables(0)
GridEX1.DataBind()
dsDataset.Tables(0).TableName = "DataMembers"
As you can see I am then renaming the dataset table to "DataMembers"
Now further one in my code, I want to loop through the dataset table "DataMembers" one row at a time. The code that I am using is:
Code:
For Each dr As DataRow In dsDataset.Tables("DataMembers").Rows
Next
The problem that I am getting is: Object reference not set to an instance of an object.
This errors is thrown for the first line of the for loop.
Any suggestions??
Mike55