sqlserver中的datetime类型对应VC中是什么类型?如何将CString类型转换成这个类型. sqlserver中的datetime类型对应VC中是什么类型?如何将CString类型转换成这个类型以便并将这个值插入到datetime类型的列中.??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 直接用字符串啊, str.Format("insert into a(thedate) values ('%s')" ,strDate);strDate是格式好的字符串如:2000-10-10 00:00:00 从datetime去数据到CString才需要用COleDateTime转换呢 直接将CString 格式化为字符串就能插入过去么??我试试先 zcp126()能再说明白点吗,我也想知道 //从sql server取datetime.....>CStringvariant vdate;vdate.vt = VT_DATE;CString strDate;vdate = rs->GetCollect("coldate");if ( vcate.vt != NULL)//从datetime ---> CString strDate = COleDateTime(vdate).Format("%Y-%m-%d %H:%M:%S");//Insert a record with datetimecolumn to sqlserverCString sql ,strDate;strDate = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");sql.Format("insert into A(thedate) values ('%s')" ,strDate);//构造语句con->Execute(_bstr_t(sql),&RecordsAffected,adCmdText);//执行 我发现我完全不了解指针【杯具帖】 __gc是干什么用的 请问单击鼠标怎样更新图片 100分不够,可以再加,请教:SDK已实现TreeCtrl,但如何加入多页面? 求助:基于对话框的程序不能弹出主对话框是什么原因? 如何在线修复MSDN 求教关于模太对话框只能弹出一次的问题! 请问:我在Myproject.cpp中定义的全局函数,为什么在其他类中不能使用 帮我看这个错误,UP者有分! Windows虚拟打印 如何在GPD文件添加360*360DPI的选项 怎样自定义接收外部程序传入的响应消息 有没办法在View类中加上CDialogBar啊
strDate是格式好的字符串如:2000-10-10 00:00:00
variant vdate;
vdate.vt = VT_DATE;
CString strDate;
vdate = rs->GetCollect("coldate");
if ( vcate.vt != NULL)//从datetime ---> CString
strDate = COleDateTime(vdate).Format("%Y-%m-%d %H:%M:%S");//Insert a record with datetimecolumn to sqlserver
CString sql ,strDate;
strDate = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
sql.Format("insert into A(thedate) values ('%s')" ,strDate);//构造语句
con->Execute(_bstr_t(sql),&RecordsAffected,adCmdText);//执行