all groups > sql server odbc > february 2004 >
You're in the

sql server odbc

group:

SQLDescribeCol/SQLColAttribute


SQLDescribeCol/SQLColAttribute Lewis Howell
2/10/2004 9:51:27 AM
sql server odbc:
I am trying to get SQLDescribeCol to return column names (alias) from
multiple result sets in a stored procedure but it returns a nil string. I
have also tried SQLColAttribute with no success.

Any suggestions, places to read, different newsgroups, code to try, etc. ???

--

Thanks,
Lewis Howell
Innovative Business Software
www.ibsoft-us.com

Re: SQLDescribeCol/SQLColAttribute Brannon Jones [MS]
2/11/2004 12:48:32 PM
If you have multiple result sets, then you need to use SQLMoreResults() to
move to the next result set. Also, check that your input parameters to
SQLDescribeCol are correct. SQLDescribeCol should return a valid column
name in all cases (unless the column doesn't have a name, which is possible
if the column is a computed column or literal string.

--
Brannon Jones
Developer - MDAC
This posting is provided "as is" with no warranties and confers no rights.


[quoted text, click to view]

Re: SQLDescribeCol/SQLColAttribute Lewis Howell
2/11/2004 4:32:37 PM
Thanks...I found my problem. In Delphi I was passing parameter as PChar
which is accurate to the Microsoft documentation. I finally got it to work
by sending in an array[0..30] of Char.

--

Thanks,
Lewis Howell
lou@ibsoft-us.com
Innovative Business Software
www.ibsoft-us.com


[quoted text, click to view]

Re: SQLDescribeCol/SQLColAttribute Brannon Jones [MS]
2/11/2004 4:33:59 PM
You must pass a pointer to some memory in order for the API to return the
column name. If you pass the value nil to the API, we will not return the
column name. You should be able to use a PChar, but you must point it to a
buffer first. Something like this might work (bear with me, my
Pascal/Delphi is rusty):

var
name: array[0..30] of Char;
pname: PChar;

pname := @name;

Then you pass 'pname' to the API. That should work. It's been a long time
since I've written code in Pascal.

Make sense?

--
Brannon Jones
Developer - MDAC
This posting is provided "as is" with no warranties and confers no rights.


[quoted text, click to view]

AddThis Social Bookmark Button