I am using Visual Studio 2008, and SQL Server, Currently I have a connection using ADO, but would like to retrieve the number of columns a table has...
Here is what I have
/*CODE FOR connecting to database**/
/*query to know number of columns in table*/
_bstr_t sSQLd="Select Count(*) From INFORMATION_SCHEMA.COLUMNS Where TABLE_NAME='[dbo].[mytable]';";
/*define variable to hold number of columns and
print number of coulms as an integer
*/
int COLS_PER_ROW = wcstod(sSQLd, NULL);
printf("COLS_PER_ROW: %d", COLS_PER_ROW);
It prints 0
although There are 20 columns in my table
How do I fix the query or the logic??