Odbc returns empty string instead of null . I have used SQLBindParameter which binds the values.How to get Null values instead of empty string (blank).
Asked
Active
Viewed 514 times
0
-
2Possible duplicate of [ODBC: How to bind a empty string?](https://stackoverflow.com/questions/24545494/odbc-how-to-bind-a-empty-string) – Jun 02 '17 at 06:51
1 Answers
0
Here is an example:
SQLINTEGER sqllen = 0;
SQLCHAR buf[255] = { 0 };
while ((retcode = SQLFetch(_hstmt)) != SQL_NO_DATA)
{
if (SQLGetData(_hstmt, 1, SQL_C_CHAR, &buf[0], sizeof buf + 1, &sqllen) == SQL_NULL_DATA)
{
this_is_your_string = nullptr;
}
}
This makes the string have a nullptr value, this is C++ 11. Also see this post

chongo2002
- 131
- 1
- 5
- 12