Number of rows in dataset

T

tshad

I have a dataset that I am going to navigate through and need to set up an
array beforehand.

******************************************
Dim oData as new DataSet()
Dim oAdpt as new SqlDataAdapter(sQuery,objConn)
oAdpt.Fill(oData,"tempTable")

for each dr as datarow in oData.Tables(0).Rows
trace.warn("Inside Datarow navigation" & dr("answer"))
next
*******************************************

Is there a property (oData.Tables(0).?) that would tell me how many rows are
in the table that were returned?

Thanks,

Tom.
 
T

tshad

Joyjit Mukherjee said:
oData.Tables[0].Rows.Count

Tried that and got the following message:
*********************************************************************
Compiler Error Message: BC30311: Value of type
'System.Data.DataTableCollection' cannot be converted to 'Integer'.

Source Error:

Line 449: dim temp as integer
Line 450:
Line 451: temp = oData.Tables[0].Rows.Count
Line 452:trace.warn("Number of rows in table - " & temp)
Line 453:
****************************************************************************

Am I missing something?

Thanks,

Tom
 
T

tshad

tshad said:
Joyjit Mukherjee said:
oData.Tables[0].Rows.Count

Tried that and got the following message:
*********************************************************************
Compiler Error Message: BC30311: Value of type
'System.Data.DataTableCollection' cannot be converted to 'Integer'.

Source Error:

Line 449: dim temp as integer
Line 450:
Line 451: temp = oData.Tables[0].Rows.Count
Line 452:trace.warn("Number of rows in table - " & temp)
Line 453:
****************************************************************************

Am I missing something?

I was.

Yours was c# and I neglected to change the [0] to (0) for VB.net.

It works fine.

Thanks,

Tom
 
S

Sahil Malik

temp = CInt(oData.Tables[0].Rows.Count)
or CType(oData.Tables[0].Rows.Count,Integer)
(Sorry my VB.NET is a bit rusty)
- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik

tshad said:
Joyjit Mukherjee said:
oData.Tables[0].Rows.Count

Tried that and got the following message:
*********************************************************************
Compiler Error Message: BC30311: Value of type
'System.Data.DataTableCollection' cannot be converted to 'Integer'.

Source Error:

Line 449: dim temp as integer
Line 450:
Line 451: temp = oData.Tables[0].Rows.Count
Line 452:trace.warn("Number of rows in table - " & temp)
Line 453:
****************************************************************************

Am I missing something?

Thanks,

Tom
regards
Joyjit

rows
are
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top