CString sSql = "";
CTime tTime = CTime::GetCurrentTime();
CString m_sLoginTime = tTime.Format("%Y-%m-%d %H:%M:%S"); sSql.Format("INSERT INTO [tb_tc_info]([tc_ltime])VALUES('%s')",m_sLoginTime); if (!g_dhDatabaseHelper.Execute(sSql, NULL, NULL))
{
AfxMessageBox("插入数据库失败");
}
CTime tTime = CTime::GetCurrentTime();
CString m_sLoginTime = tTime.Format("%Y-%m-%d %H:%M:%S"); sSql.Format("INSERT INTO [tb_tc_info]([tc_ltime])VALUES('%s')",m_sLoginTime); if (!g_dhDatabaseHelper.Execute(sSql, NULL, NULL))
{
AfxMessageBox("插入数据库失败");
}
2010-1-1转换为#2010-1-1#
try
{
//你的ADO代码
}
catch (_com_error& e)
{
AfxMessageBox(e.Description());
}