I have trouble writing a character into the database (the column is declared as 
char(2) not null) because I figured that if it appends a null at the end of the 
character data I want to insert (i.e.'A\0'), it would still fit. I bound the 
parameters first before assigning the data and executing a statement to write into the 
database. This is how I bind it:

-------------------------------------------------------------------------------------------
g_rc = SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 2, 0, 
(SQLPOINTER)chDataPart, 1, NULL);
->if I put NULL in the last parameter in the SQLBindParameter function, I get the 
following error for the SQLParamData function call,

Error code: HY090
Error message: SQLBindParameter not used for all parameters.

However, I see many working examples that sets the last parameter to NULL when it is a 
string. I'm not sure if it works for a character. I've checked the manual and list 
archives and found out that the above error message means [there is an error in the 
number of parameters in an insert statement]. What does this mean?

-------------------------------------------------------------------------------------------
g_rc = SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 2, 0, 
(SQLPOINTER)chDataPart, 1, 0);
->the funny thing is, if I put 0 in the last parameter in the SQLBindParameter 
function I don't get any error but the character data (i.e. 'A') that I assigned to 
the bound parameter would not be written into the database.

Am I missing out something here? Please advise.

Thanks in advance,
lisze

Reply via email to