Hi,
I am trying to insert a TIME value in a SQL Server 2008 database using
a simple ODBC C program. I follow the steps below:
1. Connect and Allocate Statement handle
2. Prepare a Statement as:
rc = SQLPrepare(hstm t, "insert into table1 values (?)" ,
SQL_NTS);
(NB: Table1 has only one column of type TIME in SQL Server 2008)
3. Bind the parameter:
rc = SQLBindParamete r(hstmt,1,SQL_P ARAM_INPUT,
SQL_C_BINARY,SQ L_SS_TIME2, 16,7, &buffer,
sizeof(SQL_SS_T IME2_STRUCT ), 0);
(where, buffer is of type SQL_SS_TIME2_ST RUCT and buffer.hour = 12;
buffer.minute=1 2; buffer.second =12; buffer.fraction = 0)
I also tried SQL_C_DEFAULT instead of SQL_C_BINARY and got the same
error.
4. rc = SQLExecute(htsm t)
Appreciate any help to resolve this.
Thanks in Advance,
Navneet
I am trying to insert a TIME value in a SQL Server 2008 database using
a simple ODBC C program. I follow the steps below:
1. Connect and Allocate Statement handle
2. Prepare a Statement as:
rc = SQLPrepare(hstm t, "insert into table1 values (?)" ,
SQL_NTS);
(NB: Table1 has only one column of type TIME in SQL Server 2008)
3. Bind the parameter:
rc = SQLBindParamete r(hstmt,1,SQL_P ARAM_INPUT,
SQL_C_BINARY,SQ L_SS_TIME2, 16,7, &buffer,
sizeof(SQL_SS_T IME2_STRUCT ), 0);
(where, buffer is of type SQL_SS_TIME2_ST RUCT and buffer.hour = 12;
buffer.minute=1 2; buffer.second =12; buffer.fraction = 0)
I also tried SQL_C_DEFAULT instead of SQL_C_BINARY and got the same
error.
4. rc = SQLExecute(htsm t)
Appreciate any help to resolve this.
Thanks in Advance,
Navneet
Comment