Trying to get ADO to work!... frustrated =/ 
Author Message
 Trying to get ADO to work!... frustrated =/

Coming from ASP/VB I am finding that the jump to delphi isnt all that
difficult and I am happy to be here after noticing several performance gains
in one environment versus the other.

I am now at a point where I am stumped.  Knowing ADO and it's uses in VB, I
am attempting to pull off a .GetRows on the recordset object to retrieve the
records as opposed to a .movenext loop.  Problem is, I haven't the foggiest
idea how to handle this oleVariant array of oleVariants.  What happened to
just being able to call the .GetRows and then run a for next loop to yank
out the values that I need?

Any help would be greatly appreciated.  I have searched all over the web and
the samples/examples I am finding aren't geared to ADO specifically (many
documents on TStringLists and such) but in trying them, they still wouldnt
work to read the array elements.  Maybe someone has a link or knows the
exact one or two lines that I am looking for.

Thanks!
Ben



Sun, 01 Jan 2006 22:38:10 GMT  
 Trying to get ADO to work!... frustrated =/
If the OLE object supports a "GetRows" property/method then you should
be able to use that in Delphi. If you declare a variant and it's an
array then you should be able to simply use it.  Is the nature of your
problem perhaps "how to declare things?"  Please elaborate to the
group.  

Delphi includes things like TStringLists and so-on having various uses,
but in your case (working basically all-the-time with OLE/Variant
variables) you probably won't be using these.  Delphi has "variant
arrays" and a search for this topic in its online help might get you
started down the right course.

Quote:

> Coming from ASP/VB I am finding that the jump to Delphi isnt all that
> difficult and I am happy to be here after noticing several performance gains
> in one environment versus the other.

> I am now at a point where I am stumped.  Knowing ADO and it's uses in VB, I
> am attempting to pull off a .GetRows on the recordset object to retrieve the
> records as opposed to a .movenext loop.  Problem is, I haven't the foggiest
> idea how to handle this oleVariant array of oleVariants.  What happened to
> just being able to call the .GetRows and then run a for next loop to yank
> out the values that I need?

> Any help would be greatly appreciated.  I have searched all over the web and
> the samples/examples I am finding aren't geared to ADO specifically (many
> documents on TStringLists and such) but in trying them, they still wouldnt
> work to read the array elements.  Maybe someone has a link or knows the
> exact one or two lines that I am looking for.



Mon, 02 Jan 2006 06:51:26 GMT  
 Trying to get ADO to work!... frustrated =/

Quote:

> Coming from ASP/VB I am finding that the jump to Delphi isnt all that
> difficult and I am happy to be here after noticing several performance gains
> in one environment versus the other.
> I am now at a point where I am stumped.  Knowing ADO and it's uses in VB, I
> am attempting to pull off a .GetRows on the recordset object to retrieve the
> records as opposed to a .movenext loop.  Problem is, I haven't the foggiest
> idea how to handle this oleVariant array of oleVariants.  What happened to
> just being able to call the .GetRows and then run a for next loop to yank
> out the values that I need?
> Any help would be greatly appreciated.  I have searched all over the web and
> the samples/examples I am finding aren't geared to ADO specifically (many
> documents on TStringLists and such) but in trying them, they still wouldnt
> work to read the array elements.  Maybe someone has a link or knows the
> exact one or two lines that I am looking for.

ADO may be very different from the component sets I've been using, but my code
in Delphi usually follows this pattern.
(The query (q) holds a SELECT statement in the SQL property)

q.Open;
while not q.Eof do
begin
  ID := q.FieldByName('ID').AsInteger;
  NAME := q.FieldByName('NAME').AsString;
// do important stuff
  q.Next;
end;
q.Close;

This may be totally irrelevant to your (ADO) case, but maybe it shows the
corresponding verbs for doing GetRows and MoveNext.

Regards,
Aage J.



Mon, 02 Jan 2006 15:11:10 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ADO problem ... (second try)

2. Getting SQL Server XML through ADO into Delphi

3. Just try this, it will work

4. still trying to get random number generation to work

5. Just try this, it will work

6. Just try this, it will work

7. Just try this, it will work

8. Just try this, it will work

9. Just try this, it will work

10. Just try this, it will work

11. Just try this, it will work

12. Just try this, it will work

 

 
Powered by phpBB® Forum Software