VB + access 数据库
select * from a where name='%' 通配符 '%' 在语句中代表零个或多个字符 可是当数据表中当某条记录 name 字段内容为空时, 用这个语句却查不出这条记录, 用 '*' 更是不行,一条都查不出来 有没真的 "在语句中代表零个或多个字符" 的通配符啊
select * from a where name='%' 通配符 '%' 在语句中代表零个或多个字符 可是当数据表中当某条记录 name 字段内容为空时, 用这个语句却查不出这条记录, 用 '*' 更是不行,一条都查不出来 有没真的 "在语句中代表零个或多个字符" 的通配符啊
从 textbox
if textbox.text <>""
str = textbox.text
else
str='%'
endif
"select * from a where name=" & str ...............条件比较多, 用 where name='%' or name=null 怕会有点乱 , 求经验
text1.text空或不空都可以
苗苗的方法不行啊 text1.text 空的当然可以查,但查不出数据库中 name 为空的记录
那还加过滤干吗?直接
select * from a
如果有别的条件,
select * from a where 别的条件
str = "='"& textbox.text & "'"
Else
str="is null"
Endif
"select * from a where name" & str ...............
strsql = "select * from a where name='" & textbox.text & "' "
else
strsql = "select * from a where "
endifstrsql = strsql & " and "其它条件