数据库查询问题,急!!!有分哟~~ (一个很菜的问题~~)
我有一通信录的库,想做一个查询的程序,点击查询后,弹出一个frame,上面有姓名,性别,联系电话,如果我按这些条件查询怎么写语句,我的这个怎么老是出错,我真的很菜,教教我吧,我急用!!!
Option Explicit
allinfo="select name as 姓名,sex as 性别,telephone as 联系电话,address as _地址,zip as 邮编 from 通信录"
private sub command1_click()
dim t,m,n as string
if IsNumeric(text1.text) then
m="name"+text1.text
end if
if IsNumberic(text2.text) then
n="sex"+text2.text
end if
if m="" and n="" then
t=""
else
if m="" then
t=n
else
if n="" then
t=m
else
t=m+" and "+n
end if
end if
end if
if t<>"" then
t="where"+t
end if
adodc1.recordsource=allinfo+t
adodc1.commandtype=adcmdtext
adodc1.refresh
end sub
而且adodc1.refresh那句还老出错,说至少有一个参数未设置,帮帮忙哟~~`