VB和SQL问题,急

来源:百度知道 编辑:UC知道 时间:2024/06/20 15:27:31
我在用VB和SQL做课设,做的程序在查询数据库表里的数据时,如果没有那数据就会弹出,请问该加什么语句,麻烦该加哪都说的详细点

用IF语句呀
例如:
rst.open "select * from 表1 where username = '张三'", conn
if rst.eof then 'rst为adodb.recordset, conn为adodb.connection
msg "没找到"
exit sub 'or exit function
end if
msg "找到了" 'rst.eof为false时表示找到资料了