在vb中如何引用日期型的变量

来源:百度知道 编辑:UC知道 时间:2024/06/05 17:19:23
在vb中如何引用日期型的变量
具体代码如下

Dim datefrom As Date
Dim dateto As Date

datefrom = Text1.Text
dateto = Text2.Text
sql = "select sbrand as 品牌,sintype as 进货方式,sum(icount) as 数量 from stockshop where ddate between '" & datefrom & "'and '" & dateto & "'and group by sbrand,sintype"

总是报“要求对象”的错
请帮忙解决,解决了一定会采纳的,谢谢

sql = "select sbrand as 品牌,sintype as 进货方式,sum(icount) as 数量 from stockshop where ddate between cdate('" & text1.text & ")'and cdate('" & text2.text & "') group by sbrand,sintype"

前面的语句都不要。

你不如把数据库里面弄成字符串形,然后再连,那样比较方便

数据库链接错误。检查你的数据库链接方式。