// 读取日期
var = m_pResultSet->GetCollect(_variant_t("Birth_Time")); DATE dt = var.date;
COleDateTime da = COleDateTime(dt);
CString strData = da.Format(_T("%Y-%m-%d"));
m_GridList.SetItemText(m_nRow, m_nColumn, strData); // 写入日期
COleDateTime oleDate = COleDateTime::GetCurrentTime();
CString strDate = oleDate.Format(_T("%Y-%m-%d %H:%M:%S")); m_pBorrowRS->Fields->GetItem(_variant_t("Borrow_Date"))->PutValue(_variant_t(strDate));
m_GridList.SetItemText(m_nRow, m_nColumn, strDate); 或:
COleDateTime oleDate = COleDateTime::GetCurrentTime(); _variant_t vtDate;
vtDate.vt = VT_DATE;
vtDate = oleDate.Format(_T("%Y-%m-%d %H:%M:%S")); m_pBorrowRS->Fields->GetItem(_variant_t("Borrow_Date"))->PutValue(vtDate);
m_GridList.SetItemText(m_nRow, , (LPCTSTR)_bstr_t(vtDate));
COleDateTime::GetCurrentTime() var.date \ / \ / \ / COleDateTime oleDate; / \ / \ / \ var = oleDate.Format(...) strDate = oleDate.Format(...)

也可以是用sql语句直接插入的方式:

strSql.Format(_T("update SESSIONS set BLOGGEDON = 0 ,DATE_LOGOFF = to_date('%s', 'YYYY/MM/DD HH24:MI:SS')  where ID = '%s'"),

这就是直接插入时间了

ps:

检查字符串是否为空

FieldPtr filedptrTmp = m_pRecordset->Fields->GetItem((_bstr_t)(LPCTSTR)m_strDatabaseTheoryWeight);
   if ((filedptrTmp->Value.vt != VT_NULL) && (filedptrTmp->Value.vt != VT_EMPTY))
    FieldPtr filedptrTmp = 。。。。

ADO读写DateTime方式的更多相关文章

  1. R语言读写中文编码方式

    最近遇到一个很头疼的事,就是 R语言读写中文编码方式.在网上找到了一篇博文,谢谢博主的精彩分享,让我很快解决了问题,在此也分享一下 R语言读写数据的方法很多,这里主要是我在使用read.csv/rea ...

  2. read/write数据读写传输方式(转)

    前言 笔者本打算撰写一篇讲解标准I/O(缓存I/O)的博文,但是发现已经有网友做过同样的工作,并且工作质量上乘,特转载于此. 原文地址http://lenky.info/archives/2012/0 ...

  3. Delphi中ADO异步执行方式

    当ADO开始处理数据后,应用程序必须等到ADO处理完毕之后才可以继续执行.但是除了同步执行方式之外,ADO也提供了异步执行的方式,允许当ADO处理时,应用程序仍然能够先继续执行.而当ADO处理数据完毕 ...

  4. Delphi通过ADO读写数据库

    ADO是一种程序对象,用于表示用户数据库中的数据结构和所包含的数据. ADO (ActiveX Data Objects,ActiveX数据对象)是Microsoft提出的应用程序接口(API)用以实 ...

  5. ADO.NET 连接方式和非链接方式访问数据库

    一.//连接方式访问数据库的主要步骤(利用DataReader对象实现数据库连接模式) 1.创建连接对象(连接字符串) SqlConnection con = new SqlConnection(Co ...

  6. C++通过ADO读写Excel文件

    介绍 有时候我们需要从excel表格里导入.导出数据.其中一种方式就是通过ADO的方式.在这里,excel文件被当作数据库来处理,该方式不需要客户端安装Microsoft Excel,速度也够快. 连 ...

  7. C++文件读写 打开方式等比较全

    要求:掌握文本文件读写的方法了解二进制文件的读写方法 C++文件流:fstream // 文件流ifstream // 输入文件流ofstream // 输出文件流 //创建一个文本文件并写入信息// ...

  8. ADO.NET连接方式

    使用Command.DataReader和DataSet两种方法实现数据绑定 方法1:使用Command和DataReader SqlConnection con = new SqlConnectio ...

  9. ADO 读写文本文件

    ' 创建配置文件            Open ThisWorkbook.Path & "\schema.ini" For Append As #1            ...

随机推荐

  1. 15. 迭代器模式(Iterator Pattern)

    动机(Motivate):     在软件构建过程中,集合对象内部结构常常变化各异.但对于这些集合对象,我们希望在不暴露其内部结构的同时,可以让外部客户代码透明地访问其中包含的元素;同时这种“透明遍历 ...

  2. C#图像检测开源项目

    AForge.NET AForge.NET is an open source C# framework designed for developers and researchers in the ...

  3. 鼠标右键Table的td弹出多级菜单,双击td编辑

    <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="C ...

  4. 【leetcode-73】 矩阵置零

    给定一个 m x n 的矩阵,如果一个元素为 0,则将其所在行和列的所有元素都设为 0.请使用原地算法. 示例 1: 输入: [   [1,1,1],   [1,0,1],   [1,1,1] ] 输 ...

  5. HDU - 1272 小希的迷宫(并查集判断环)

    https://cn.vjudge.net/problem/HDU-1272 Description 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardo ...

  6. jquery 控制 video 视频播放和暂停

    $('video').trigger('play'); $('video').trigger('pause'); 参考:https://blog.csdn.net/arvin0/article/det ...

  7. Java SSM框架之MyBatis3(十)MyBatis批量插入数据(MySql)

    插入成功后返回自增主键 <insert id="insertRole" parameterType="role" useGeneratedKeys=&qu ...

  8. sqlserver2012 offset分页

    select ID,UserName from user order by ID OFFSET (10 * (50-1)) ROW FETCH NEXT 10 rows only

  9. VS2019预览版发布了

     VS2019正式版已发布:https://www.cnblogs.com/zhaogaojian/p/10648904.html 1.点击下载https://visualstudio.microso ...

  10. DataReader分页性能测试

    参考程序地址:http://www.cnblogs.com/eaglet/archive/2008/10/09/1306806.html 最近遇见程序慢的问题,使用的DataReader,猜想是分页导 ...