关于Access数据库中时间存储的问题(急呀)

csdn5201 2003-08-10 04:17:36
我在写一个进销存过程中vbshortdate型的日期(如03-8-9)放入到Access中后用datagrid 显示时会显示成09-3-8。其中access数据库中字段的属性为短日期。
代码如下:
strSql = "select * from inlet_product_info where product_type='" & Trim(cmbProducttype1.Text) & "' and product_name='" & Trim(cmbProductname1.Text) & "' and product_num='" & Trim(cmbProductgg1.Text) & "' and product_unit='" & Trim(cmbUnit1.Text) & "' and numbers=" & Trim(txtNumber1.Text) & " and buy_price=" & Trim(txtBuyprice1.Text) & " and buy_date=#" & Trim(dtBuydate1.Value) & "# and product_company='" & Trim(cmbPcompany1.Text) & "' and contain_tax='" & Trim(cmbContaintax1.Text) & "' and total_cost=" & Trim(txtTotalcost1.Text) & " and pay_money='" & Trim(txtPay1.Text) & "' and owe_money=" & Trim(txtOwemoney1.Text) & " and single_price=" & Trim(txtSingleprice1.Text) & " and inlet_name='" & Trim(cmbInletname1.Text) & "' and details='" & Trim(txtDetails1.Text) & "'"
Set recSet = gCnn.Execute(strSql)
其它字段正常只有buy_date(03-8-9)存入数据库后出现问题值为09-3-8
可能是数据库设置出现错误
请高手指点一下为什么年-月-日型的时间存入access短日期型的字段,值为日-年-月


...全文
45 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
csdn5201 2003-08-10
  • 打赏
  • 举报
回复
请教高手怎样在数据库中设置的问题!!!
我已经在输入前做过时间格式化的工作,但还是不行
j4sxw 2003-08-10
  • 打赏
  • 举报
回复
UP
gpo2002 2003-08-10
  • 打赏
  • 举报
回复
1,修改数据库对应子段的日期类型
2,select的时候格式化对应字段
shawls 2003-08-10
  • 打赏
  • 举报
回复
是你看的问题,在access里面设置,自己看看

实际数据库是没有关系的

1,216

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧