0

I want to do like this,

if(data type is char)

SQLBindCol(hStmt, i+1, SQL_C_CHAR, data[i], sizeof(data), &nulldata[i]);

else if(data type is float)

SQLBindCol(hStmt, i+1, SQL_C_FLOAT,&fData[i], sizeof(fData), &nulldata[i]);

So how can I know data type?.?

hye
  • 11
  • 2
  • 1
    Use [SqlDescribeCol](https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqldescribecol-function). There is a good example of using it [here](http://www.easysoft.com/developer/languages/c/examples/DescribeAndBindColumns.html). – RamblinRose May 12 '17 at 12:18
  • Possible duplicate of [How do I check if a variable is of a certain type (compare two types) in C?](http://stackoverflow.com/questions/6280055/how-do-i-check-if-a-variable-is-of-a-certain-type-compare-two-types-in-c) – Badda May 12 '17 at 12:20
  • This is possibly a duplicate of [How to determine the datatypes of the results of a SQL?](http://stackoverflow.com/questions/440123/how-to-determine-the-datatypes-of-the-results-of-a-sql/440192#440192) – RamblinRose May 12 '17 at 12:41
  • wowww you saved my whole time. I searched this problem about 4 hours. I appreciate you help. – hye May 12 '17 at 12:54

0 Answers0