vb 一个小问题 - VB / 基础类
我用vb编程,其中一个combox控件的dataformat 设为日期,如2010-7-1,数据库中有个字段为日期型,也如2010-7-1,我想实现在combox选中一个日期之后,执行语句:
Adodc1.RecordSource = "select * from 销量目标 where 时间='Combo1.Text'"
Adodc1.Refresh
提示错误:标准表达式中数据类型不匹配
我想是combox 和access数据库中的字段的日期类型有问题,不知道具体什么问题,如何解决,请写出解决代码。谢谢!!!!!!!!!!!!!!!!!!!!!!
Adodc1.RecordSource = "select * from 销量目标 where 时间='" & Combo1.Text & "'"
数据库为SQL:
Adodc1.RecordSource = "select * from 销量目标 where 时间='"& Combo1.Text &"'"
数据库为ACCESS:
Adodc1.RecordSource = "select * from 销量目标 where 时间=#"& Combo1.Text &"#"
Adodc1.RecordSource = "select * from 销量目标 where 时间=#" & Combo1.Text & "#"
Adodc1.Refresh
Sql语句有误,字符串连接错误
VB code:
Adodc1.RecordSource = "select * from 销量目标 where 时间[color=#FF0000]='Combo1.Text'"[/color][b][/b]Adodc1.Refresh
改为
VB code:
Adodc1.RecordSource = "select * from 销量目标 where 时间=#" & Combo1.Text
相关问答:
在vb中如何读取Word内容(包含表格,图片,等)
竟然不是zero。
不知道怎么实现的不要说话
这个只能读文本,
VB code:
Private Sub Command1_Click()
Dim WordApp As Object
Set WordApp = CreateObject(& ......
我想把word另存为xml之后,用vb读取这个xml的内容,请问如何实现?
dim f as integer
dim b() as byte
dim s as string
dim L as long
f=freefile()
open "abc.xml" for binary access read as #f
......
Private Sub Command1_Click()
Dim MyString() As String
Open "a.xml" For Binary As #1 ' 打开刚创建的文件。
ReDim MyString(LOF(1) - 1)
Put #1, , MyRecord ' 读入所有字符到变量中 ......
数据库里有一个字段的内容是二进制,怎么才能把这个二进制读出来
使用字节流对象可以实现
例如现在数据库里有个字段的内容是0x504B03040A0000000800407F263C3B02465390000000820000000A0000006273CECACCE22E7478 ......
form1中有text1-8, 和command1
text8中为程序代码(生成窗体为form2(已做好))
单击command1后将text2中的代码生成EXE到d:\ 并且text1-7分别对应
产品名 公司名 合法版权 合法商标 文件描述 注释 标题
......