登录
首页 嵌入式系统 嵌入式系统
回帖 发帖
正文

主题:CVI正确读出ACCESS中的Datetime

点击:643 回复:0

  cviÊǹ¤Òµ²â¿Ø±à³ÌµÄÀûÆ÷£¬µ±cviÒª´¦ÀíºÍ·ÖÎö´óÁ¿µÄ»·¾³Êý¾Ýʱ£¬ºÃµÄ±à³ÌÄ£ÐÍÊÇʹÓÃÉÏÊý¾Ý¿âÀ´±£´æ³ÉÐÐǧÉÏÍòµÄÊý¾Ý£¬È»ºócviͨ¹ýodbc½Ó¿Ú£¬Ê¹ÓÃsqlÓïÑÔÀ´ÊµÏÖ¸´ÔÓµÄÊý¾Ý²Ù×÷£¨Ìõ¼þÑ¡Ôñ£¬max£¬min£¬avg£¬Ö¸¶¨Ê±¼äselectµÈ¹¦ÄÜ£©¡£
¡¡cviµÄsql toolsÊÇÒÔodbcΪ½Ó¿ÚÀ´Á´½Ó¸÷ÖÖÖ§³ÖodbcµÄÊý¾Ý¿âµÄ£¬Òª×¢ÒâµÄÊÇ£¬cviÔÚͨ¹ýodbcÀ´Ñ¡ÔñÊý¾Ý¿â±íµÄ¸÷¼Ç¼ʱËùдµÄselectÒª·ûºÏ¸ÃÊý¾Ý¿âµÄsqlÌص㣬ÈçaccessµÄsql¾ÍºÍansi sqlÓÐЩÇø±ð£¬ËùÒÔ²»ÄÜÖ±½Ó°ÑÆäËûÊý¾Ý¿âsql Óï¾ä°á¹ýÀ´¾ÍÓã¬ÏÂÃæÊǺܳ£Óõģ¬cvi Ñ¡Ôñaccesss datetimeÊý¾ÝÏîʱµÄselectÓï¾ä£¬ÔÚaccessÖÐÒªÓÃformatÀ´¸ñʽ»¯datetimeÊä³ö£¬cvi¿ÉÒÔÓÃ
resultcode = dbbindcolchar (hstat, 4, 50, value_drinktime, &status_drinktime, );À´Æ¬Àú£¬¾Í¿É¶Á³öaccesss datetime£¬²¢ÕýÈ·¸ñʽ»¯¡£
note1£ºcvi sql tools ±¾ÉíûÓÐÓëdatetimeÏà¹ØµÄ°ó¶¨ÊµÏÖ£¬Ö»ÄÜÒÔsqlµÄ·½Ê½·¢ËÍÐèÇó¸øÊý¾Ý¿â£¬ÈÃÊý¾Ý¿â¸ñʽ»¯ºÃcviËùÖ§³ÖµÄ¸ñʽºó£¬cvi²ÅÄÜÕýÈ·¶ÁÈ¡Êý¾Ý¿âÖеļǼ¡£
note2£ºcvi ËùÄÜÖ±½Ó°ó¶¨µÄÀàÐÍÈçÏ£º
/* bind columns method functions */
extern int sqlfunc dbbindcolchar(int hstmt, int colnum, unsigned long stringsize, char *valptr, long *varstatus, char *fmt);
extern int sqlfunc dbbindcolshort(int hstmt, int colnum, short *valptr, long *varstatus);
extern int sqlfunc dbbindcolint(int hstmt, int colnum, int *valptr, long *varstatus);
extern int sqlfunc dbbindcollonglong(int hstmt, int colnum, __int64 *valptr, long *varstatus);
extern int sqlfunc dbbindcolfloat(int hstmt, int colnum, float *valptr, long *varstatus);
extern int sqlfunc dbbindcoldouble(int hstmt, int colnum, double *valptr, long *varstatus);
extern int sqlfunc dbbindcolbinary(int hstmt, int colnum,
unsigned long binsize, void* valptr, long* varstatus);
note3£ºÏÂÃæÊÇÓÃaccessµÄ²éѯÉè¼Æ¹¤¾ß²âÊÔºÃsqlºó£¬cviÔÙµ÷ÓÃÊǺܺõÄcvi¿ª·¢Êý¾Ý¿â³ÌÐòµÄ¡°±à³Ìģʽ¡±¡£
http://blog.gkong.com/uploadfile3/201036164246465.jpg
----------------------------------------------
此篇文章从博客转发
原文地址: Http://blog.gkong.com/more.asp?id=111286&Name=zjcsharp
10-03-06 16:56

工控新闻

更多新闻资讯