我是连接 SQL 数据库,代码如下:
CString strText;
For(int i=0;i<10;i++)
{
pSet->GetFieldValue((short)i,strText);}
当字段的值为 NULL 或 日期/时间型 时出错,为什么会这样?
在 Access 里没有问题。
CString strText;
For(int i=0;i<10;i++)
{
pSet->GetFieldValue((short)i,strText);}
当字段的值为 NULL 或 日期/时间型 时出错,为什么会这样?
在 Access 里没有问题。
时间:
rss->GetFieldValue(p->sname,dd,SQL_C_TIMESTAMP);
if (dd.m_dwType != DBVT_NULL ){
if (dd.m_pdate->year < 1901 ) s = "";
else
s.Format("%.4d-%.2d-%.2d",dd.m_pdate->year,dd.m_pdate->month,dd.m_pdate->day ); }
数值:
rss->GetFieldValue(p->sname,dd,SQL_C_DOUBLE);
if (dd.m_dwType != DBVT_NULL )
double d1 = dd.m_dblVal;