Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net Count Columns in an Access table

Hi

What VB.net code would I use to count the number of columns in an Access table?

Thanks
Avatar of Rgonzo1971
Rgonzo1971

Hi,

pls try

myRst.Fields.Count 

Open in new window

Regards
Avatar of Murray Brown

ASKER

Hi

I connect to the database via a connection string so am looking for SQL code to do this
Hi,

pls try
SELECT COUNT(*) AS ColumnCount
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='tablename';

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks very much