Dim dr(Stack.Length) As SqlClient.SqlDataReader
Dim i as Int16
Dim cmd As New SqlClient.SqlCommand
cmd.Connection = con ' con is sql connection
con.Open()
For Each CmdTxt As String in Stack
        cmd.CommandText=CmdTxt
        dr(i)=cmd.ExecuteReader()
        i+=1
Next

Now you can easily read data using datareader  for combine result


2009/2/27 pantagruel <[email protected]>

>
> Hi,
>
> I have a situation where I have a number of queries in a stack. The
> number is generally 1, but it can theoretically be any amount.
>
> I need to execute the queries and then loop through the rows of each
> query and then combine these results, the final combination is written
> to a text file matching a particular archiving format.
> The queries do not return the same nunber of columns or rows.
> If query returns two rows 7 columns, query 2 returns 0 rows but has 4
> possible columns (if it did return anything), and query 3 returns 3
> rows 2 columns then the final output should be
>
> 3 rows 13 columns with the empty columns in the database replaced by
> particular characters.
>
> Currently I have an algorithm that does my output if I have 1 query.
>
> what I was thinking was:
>
> loop through number of queries, make new data adapter, loop through
> rows, read rows into some data structure where I can append a
> particular result by an index, for example an array and then at the
> end loop through that data structure and write it out.
>
> However I worry about that because of the potential size of what is
> returned - say a couple MB is not an unwarranted expectation that the
> choice of data structure becomes somewhat important. If I were to
> follow this method what data structure do you think I should use?
>
> The application does not need to have any particular good performance,
> but it can't crash under the strain of too much data either.
>
> Alternately if you can suggest something else that would be great, as
> the method outlined above seems inefficient. Although the best I can
> come up with under the constraints of the problem.
>
> Thanks
>
>
>


-- 
Regards
*******************
*C.Arun Kumar *
*******************

Reply via email to