Welcome! Log In Create A New Profile

Advanced

List Fields In A Memory Table

Posted by kevinw 
kevinw
List Fields In A Memory Table
May 28, 2008 06:59PM
If I query SQL Server 2005 with code like:

Connect to DB
SQLExec("SELECT * FROM tablename WHERE pkfieldname = 1", "Qry1")
SQLFirst("Qry1", 1)

I now want to spin through all of the fields in Qry1 (only 1 record), something like:

FOR i = fieldcount THEN

// I know I can get the field's value using
SQLCol("Qry1", i)

BUT how do I get the name of that field?????


TIA, Kevin
KenKnight
Re: List Fields In A Memory Table
May 28, 2008 08:56PM
Hi Kevin,

Check out SQLinfo() and then SQL.TitleCol[x]

If you want to make a table of some type you could use a "FOR" loop with SQL.NbCol as the max and then build a string in the loop with TABs between each column title.

Cheers!
ken
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: