Multiple resultset Datatable structure

Multiple resultset Datatable structure

Post by Susa » Thu, 02 May 2002 23:56:12



I'm getting some strange results from a multiple result
set.
I'm using multiple result sets in other places, and the
dataset structure is as expected. As I understand it, I
should
get one Datatable for each resultset, with rows equal to
the
number of records within the individual resultset.

With the follwing code, the dataset returns two tables,
however,
the number of rows in the first table is 2, which doesn't
make
sense.

The dataset is filled:

Sqlcommand oCmd = New SqlCommand(oConn,);
oCmd.CommandType = CommandType.StoredProcedure;
oCmd.CommandText = "spGetNotes";

DataSet dsComm = new DataSet();
oDA = new SqlDataAdapter(oCmd);
oDA.Fill(dsComm);

The stored procedure contains the following stmts:

SELECT tblComments.sComment NextAction,  
tblComments.icommentid FROM tblComments JOIN
tblPersonComments ON tblPersonComments.iCommentID =  
tblComments.iCommentID
WHERE tblPersonComments.iPersonID = 18260 and
tblComments.iCommentTypeID = 3
ORDER BY tblComments.dteDateStamp;

SELECT tblComments.sComment Notes,tblComments.icommentid
FROM tblComments JOIN
tblPersonComments ON tblPersonComments.iCommentID =  
tblComments.iCommentID
WHERE tblPersonComments.iPersonID = 18260 and
tblComments.iCommentTypeID = 1
ORDER BY tblComments.dteDateStamp;

I'm using the following to populate textbox controls in my
Webform:

txtNextAction.Text = dsComm.Tables[0].Rows[0]
["NextAction"].ToString();
txtNotes.Text = dsComm.Tables[1].Rows[0]["Notes"].ToString
();

I tested the SQL in Query Analyzer and it returns one row
for each select statement, however txtNextAction
is empty. If I change the row index to the second row:

txtNextAction.Text = dsComm.Tables[0].Rows[1]
["NextAction"].ToString();

The data is rendered in the textbox.

What is causing this strange table structure?

Any help is greatly appreciated!

 
 
 

1. Multiple Resultsets and TableName

I have a stored procedure that returns up to 4
resultsets.  However, depending on the parameters passed
there may be less than four resultsets.  How can I
determine which results where passed.  I though
the 'TableName' property of the DataSet.Table object would
have the table name that was selected from but instead has
only 'table', 'table1', etc.  How can I determine which
results I actually received?

2. Not too far off topic, I hope

3. DB2, multiple resultset

4. ShareFeed (2997224005826)

5. Questions: DataShaping, DataSet Relation Performance, Multiple Resultsets

6. How to disconnect an IP displayed in netstat?

7. Multiple ResultSets from DB2. (newbie)

8. SAS installation for beginner

9. A matter of performance (Multiple Resultsets or DataSets)

10. Binding control to stored procedure with multiple resultsets, possible?

11. public structure across multiple project classes

12. marshaling a structure array inside a structure

13. Passing a structure with an embedded array of a structure