当前位置: 代码迷 >> DB2 >> SQLBindParameter怎么绑定NULL值
  详细解决方案

SQLBindParameter怎么绑定NULL值

热度:2779   发布时间:2013-02-26 00:00:00.0
SQLBindParameter怎样绑定NULL值
对于表中的时间类型,当为空时,直接插入空字符串时会报错提示时间格式不正确,在SQL语句里能插入NULL值,我在C里面用SQLBindParameter该怎样绑定NULL值,写到时间类型的字段里?
SQL="INSERT CTEST (CLT_TIME) VALUES(?)"
parameter="2008-11-06 14:45:33.000000";

                 cliRC = SQLBindParameter(hstmt,                          
                             i,                              
                             SQL_PARAM_INPUT,                
                             SQL_C_CHAR,                     
                             SQL_CHAR,                       
                             26,
                             0,                              
                             parameter,                     
                             0,                              
                             NULL);        
当时间有值时,是可以插入的,当为空时,就不能插入,提示An invalid datetime format was detected; that is, an invalid string representation or value was specified. SQLSTATE=22007
我该怎么做?
谢谢
------解决方案--------------------------------------------------------
Just Try:
------------------------
   cliRC = SQLBindParameter(hstmt,                          
                            i,                              
  相关解决方案