|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Number of rows in datasetarray 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. 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. > > "Joyjit Mukherjee" <joyjit_mukher***@hotmail.com> wrote in message Tried that and got the following message:news:eqSdqt68EHA.2276@TK2MSFTNGP09.phx.gbl... > oData.Tables[0].Rows.Count ********************************************************************* 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. >> >> > >
Show quote
Hide quote
"tshad" <tscheider***@ftsolutions.com> wrote in message I was.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? 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. >>> >>> >> >> > > 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. > >> > >> > > > > > >
Other interesting topics
DBnull, Date and DataAdapter
Bulk Insert Via SQLCommand? GetChildRows - Finding Deleted ChildRows ? Constraint violated but no exception thrown Problem with Update Adapter Handling very huge data typed dataset and sort order on save How to get a code of stored procedure ? Null returns from DataAdapter.Fill() How Get Paramenter information in Stored Procedure (DataType,Null |
|||||||||||||||||||||||