Re: Returning multiple resultsets usind datadreader



Peter,

I never used it, however as I see the documentation than the load is using the reader, however does not give you access to that. In my idea is it another way of getting to the part of the fill without things as the standard acceptchanges what is in the fill.

You are as well not using the reader way to fill the properties/fields.

However, I did not try it.

Cor


"Peter" <Peter@xxxxxxxxxxxxxxxxxxxxxxxxx> schreef in bericht news:FEB961BC-AA99-40BA-8EE9-C8198E64D1B5@xxxxxxxxxxxxxxxx
Hi Cor,

I'm just trying different ways to retrieve data: datareader, dataadapter,
tableadapter, DAAB , and LINQ.

One of the objectives is to retrieve master-details resultsets and populate
them into datagridviews for read-only purpose. This probably will be
implemented as a class for generic usage.

Peter

"Cor Ligthert[MVP]" wrote:

Peter,

Can you explain me why you use this method, as far as I can see it now, it
is going from NY to Wasinton to Jersey City over LA.

Normally we use direct the DataAdapter Fill, however there should be a
reason?
It cannot be that it is quicker, because that is AFAIK culprit, you have to
write at least more code while the result is the same, although you need
probably after what you do now at least an acceptchanges of course, which is
automaticly done by the fill.

However, there must be a reason and I am currious about that?

Cor

"Peter" <Peter@xxxxxxxxxxxxxxxxxxxxxxxxx> schreef in bericht
news:DFE56B5A-9795-4E18-99B8-C2F7829C1CCF@xxxxxxxxxxxxxxxx
> I'm using this coding to get 2 resultsets thru datareader and then load
> them
> into 2 datatables and bind the datatables to datagridviews. But
> sdrGrid.NextResult() is returning false for some reason. Is that
> possible
> the connection is closed?
>
> Dim strConn As String = "Server=localhost;Database=northwind;" + > _
> "Integrated Security=SSPI"
> Dim cnnNwind As SqlConnection = New SqlConnection(strConn)
> Try
> Dim strSql As String = "select * from customers;select * > from
> products"
> Dim cmdGrid As New SqlCommand(strSql, cnnNwind)
> cmdGrid.CommandType = CommandType.Text
> cnnNwind.Open()
> Dim sdrGrid As SqlDataReader = cmdGrid.ExecuteReader
> Dim dt1 As New DataTable
> dt1.Load(sdrGrid)
> DGVP.DataSource = dt1
> Dim dt2 As New DataTable
> If sdrGrid.NextResult() = True Then
> dt2.Load(sdrGrid)
> DGVC.DataSource = dt2
> End If
> Catch exc As Exception
> MsgBox(exc.Message)
> Finally
> cnnNwind.Close()
> End Try


.



Relevant Pages

  • Re: n-layer approach
    ... Not enough reason for me to re-think yet. ... All it does is give me a whole load of objects to code ... and seperation of resources for code reuse. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: packages revisited
    ... you want to add to the general CL reader. ... I see no reason for not doing that. ... it in every package we are "in". ... If there is no such symbol, it is interned to:a-package ...
    (comp.lang.lisp)
  • Re: Real boot time
    ... Adobe Reader preloads itself by putting itself in the StartUp ... if, as is perhaps more likely, you never load a PDF that session, the ... Why should the graphics card driver load a hot-key ...
    (alt.linux)
  • Re: Microsoft Metro vs. Acrobat <20060627201825.2d6a3
    ... document can be broken regardless of whatever plug-ins you use (even the ones listed in ... which is one reason why Acrobat Web Buy never really took off. ... Microsoft Metro will have real DRM built right in. ... to find a RELIABLE reader acceptable to consumers that will prevent unauthorized reading ...
    (comp.text.pdf)
  • Re: culture/character noodling
    ... Part of the reason is a sense of responsibility--she has used the grass ... is both a very strong fire mage and a strong weaving mage, ... She wakes to discover that she has sunk into the earth, ... reader what you know about the character's motives. ...
    (rec.arts.sf.composition)