程序窗口上提供了3个checkbox供用户选择,当checkbox选中时,则分别将选择值定为1,2,3,如果不选择,则不做任何操作。待用户选择后,将这三个值作为查询参数传递到三个textbox中,并在数据表中找出此类型的数据。但是编译过程中出错,请帮忙看看如何将这几个控件的选择值作为查询的条件。public sub check()dim custype1,custype2,custype3 as integer
dim connection as new ADODB.connection
dim getresult as new ADODB.recordset if checkbox1.enable = True
custype1=1
textbox1.text=custype1
end if
if checkbox2.enable =True
custype2=2
textbox2.text=custype2
end if
if checkbox3.enable = True
custype3 = 3
text3.text=custype3
end ifset connection = new ADODB.connection
connection.ConnectionString = "driver={SQL Server};server=local;uid=sa;pwd=;database=test"
connection.openset getresult = new ADODB.recordset
sql = "select * from test_table where custype in ('custype1','custype2','custype3')"
getresult.open sql,connection程序可以编译执行,但是总是无法从数据表中取出记录,请大家帮忙看看到底该如何修改才能够把数据查询出来。
dim connection as new ADODB.connection
dim getresult as new ADODB.recordset if checkbox1.enable = True
custype1=1
textbox1.text=custype1
end if
if checkbox2.enable =True
custype2=2
textbox2.text=custype2
end if
if checkbox3.enable = True
custype3 = 3
text3.text=custype3
end ifset connection = new ADODB.connection
connection.ConnectionString = "driver={SQL Server};server=local;uid=sa;pwd=;database=test"
connection.openset getresult = new ADODB.recordset
sql = "select * from test_table where custype in ('custype1','custype2','custype3')"
getresult.open sql,connection程序可以编译执行,但是总是无法从数据表中取出记录,请大家帮忙看看到底该如何修改才能够把数据查询出来。
解决方案 »
- 向网页 定时发送消息 用vb如何实现?
- 如何用VisualBaisc模拟任务栏???
- 请教一下连接远程数据库的问题
- 谁能提供一个注释插入工具
- FTP客户端能不能进行文件的删除?
- 100分请教高手:请问如何获取音乐文件的波形信息?(详情见帖)
- 请问用vb快速把sql数据库中的记录快速生成到foxpro3.0的dbf数据库中去
- vb数据库编程
- 初学者在问:怎么样才能让别人也打开我的VB程序?
- 我在程序中制作了一个快显窗体,我想在他显示的时间里(5秒),能够把主窗体显示出来,可是我如果设置在form_load事件里,那他还是要把主窗体显示出来后,快显窗体才又进行等待5秒的操作………
- 求一个简单的SQL语句(超急!!)
- 我想要两个超简单的WINsock源程序,有人给我吗,谢谢
好像还是不行,请帮忙看看是否还有别的方法。
我还有一个附加条件是从两个DTPicker控件取时间的,系统可以将这条语句正确执行,并得出记录。sql=Sql = "select * from vtSalesByDealer where cdate between '" + Str(DTPicker1.Value) + "'and '" + Str(DTPicker2.Value) + "' order by cdate
sql="select * from test_table where custype in ("
if isnumeric(me.text1.text) then sql=sql+"'"& me.text1.text &"'"
if isnumeric(me.text2.text) then sql=sql+"'"& me.text2.text &"'"
if isnumeric(me.text3.text) then sql=sql+"'"& me.text3.text &"'"
sql=sql+")"
什麽意思薩?