Home All Groups Group Topic Archive Search About

Number of rows in dataset

Author
6 Jan 2005 1:31 AM
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.

Author
6 Jan 2005 4:51 AM
Joyjit Mukherjee
oData.Tables[0].Rows.Count

regards
Joyjit

Show quoteHide quote
"tshad" <tscheider***@ftsolutions.com> wrote in message
news:O13OQ%2348EHA.2316@TK2MSFTNGP15.phx.gbl...
> 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.
>
>
Are all your drivers up to date? click for free checkup

Author
6 Jan 2005 5:14 PM
tshad
"Joyjit Mukherjee" <joyjit_mukher***@hotmail.com> wrote in message
news:eqSdqt68EHA.2276@TK2MSFTNGP09.phx.gbl...
> 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

Show quoteHide quote
>
> regards
> Joyjit
>
> "tshad" <tscheider***@ftsolutions.com> wrote in message
> news:O13OQ%2348EHA.2316@TK2MSFTNGP15.phx.gbl...
>> 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.
>>
>>
>
>
Author
6 Jan 2005 5:20 PM
tshad
Show quote Hide quote
"tshad" <tscheider***@ftsolutions.com> wrote in message
news:ut4FSNB9EHA.3616@TK2MSFTNGP11.phx.gbl...
>
> "Joyjit Mukherjee" <joyjit_mukher***@hotmail.com> wrote in message
> news:eqSdqt68EHA.2276@TK2MSFTNGP09.phx.gbl...
>> 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

Show quoteHide quote
>
> Thanks,
>
> Tom
>
>>
>> regards
>> Joyjit
>>
>> "tshad" <tscheider***@ftsolutions.com> wrote in message
>> news:O13OQ%2348EHA.2316@TK2MSFTNGP15.phx.gbl...
>>> 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.
>>>
>>>
>>
>>
>
>
Author
6 Jan 2005 8:55 PM
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

Show quoteHide quote
"tshad" <tscheider***@ftsolutions.com> wrote in message
news:ut4FSNB9EHA.3616@TK2MSFTNGP11.phx.gbl...
>
> "Joyjit Mukherjee" <joyjit_mukher***@hotmail.com> wrote in message
> news:eqSdqt68EHA.2276@TK2MSFTNGP09.phx.gbl...
> > 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
> >
> > "tshad" <tscheider***@ftsolutions.com> wrote in message
> > news:O13OQ%2348EHA.2316@TK2MSFTNGP15.phx.gbl...
> >> 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.
> >>
> >>
> >
> >
>
>

Bookmark and Share