How to get the number of retrieved columns when doing a SQL Query

R

Roman Klimkowicz

Hello everyone,

i just implement an own search site in MS CRM 1.2, which searches in a
MS-SQL database.

My question is, how to get the number of retrieved columns by a SQL-query??

Any suggestions for me?

Thx...


Greets,

Roman
 
X

xianxian

hi,
i only heard number of retrieved rows ..

SELECT COUNT(column) FROM tablename

but i never heard if u can count number of columns..
isn't it like, as u do SQL query, u will already know what columns u are
retrieving?

why do u need to count the columns that u r retrieving when u already
know the columns that u r going to retrieve?

regards,
xianxian
 
R

Romantschik

xianxian said:
hi,
i only heard number of retrieved rows ..

SELECT COUNT(column) FROM tablename

but i never heard if u can count number of columns..
isn't it like, as u do SQL query, u will already know what columns u are
retrieving?

why do u need to count the columns that u r retrieving when u already
know the columns that u r going to retrieve?

regards,
xianxian

Sorry I did not mean column but the row :) - My fault .. too much work
;-)

Anyway .. I know how to get the number of rows which where retrieved by
firing a SQL-query in SQL code but I need a .NET Method oder workaround
to read this value...

Any suggestions?

Sorry for the false description in my initial post.

Greets,

Roman
 
S

Sachin Saki

Hi,

Can you more specific to problem. so i can try to provide solution.

Regards,
Sachin Saki
..NET Developer, Capgemini - INDIA
 
E

Elton Wang

If you retrieve your query result to a datatable, datatable.Rows.Count gives
you row numbers.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top