Re: wanted: select query with has no result but with columns in re



Max,

Thanks for your post!

But in my test I executed a select query which has no results.
Of course there are no 'lines' in my recordset.
And also the fields collection stays empty...or was it filled and my test
was incorrect...?

Jan

"Max Kudrenko" wrote:

> Jan,
>
> Try examining the Fields collection:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdcolfields.asp
>
> Getting the field names can be achieved by something similar to this
> code:
>
> For Each fld In rst.Fields
> Debug.Print fld.Name
> Next
>
> Hope this helps,
>
> Max Kudrenko
> Brainbench MVP Program for Visual Basic
> www.brainbench.com
>
>
> Jan wrote:
> > Hi,
> > I am querying a sql server db with ado.
> > Sometimes I receive a record in the recordset and sometimes the recordset is
> > empty. This is correct and as expected.
> > But what I want is when I receive no records I still want to retrieve the
> > format (read columns) of the recordset ( the same as I would receive if there
> > was a record)...
> > So what I want is to receive a recordset with the columns defined but with
> > no row (or even better: an empty row)
> > Cheers,
> > Jan
>
>
.



Relevant Pages

  • Re: Two columns with same name in ADO Recordset Fields collection
    ... the Fields collection of an ADO recordset? ... populate a Recordset from it to be returned to my COM clients. ... I try to populate the fields collection of a recordset, ... DefinedSize, FieldAttributeEnum Attrib, Object FieldValue) ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: run-time error 3265 Item Not Found in This Collection
    ... Your recordset has only one field, and the Fields collection is zero-based. ... > Set dbMain = CurrentDb ... > Set rsMain = dbMain.OpenRecordset ...
    (microsoft.public.access.modulesdaovba)
  • Two columns with same name in ADO Recordset Fields collection
    ... the Fields collection of an ADO recordset? ... populate a Recordset from it to be returned to my COM clients. ... I try to populate the fields collection of a recordset, ... Cannot append. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Help with understanding order of For Each Control
    ... The whole purpose of a recordset is to support operations on the Fields collection. ... A Collection object is an ordered set of items that can be referred to as a unit. ...
    (comp.databases.ms-access)
  • Re: display recordset values
    ... >>> assign the values in the record to PName? ... But I'm not sure how to use the recordset. ... >>> Public Function PNameAs String ... >> The Recordset Object has a Fields collection that holds the results. ...
    (microsoft.public.vb.database.ado)