你用什么连接的数据库!? dim rs as new ADODB.recordsetrs.open "select * from table",cn rs!学号 = txtID.text
'假定学号为字符型的dim rs as new ADODB.recordset'定义ADO记录集对象 dim strcomp as string'用于存入文本框中的字符串strcomp=trim(text1.text)rs.open "select * from XXX表 where 学号='" & strcomp & "'",cn'调用open方法来执行SQL语句,其中cn为连接对象这样就可以根据文本框中的数据来查询了。
dim rs as new ADODB.recordsetrs.open "select * from table",cn
rs!学号 = txtID.text
dim strcomp as string'用于存入文本框中的字符串strcomp=trim(text1.text)rs.open "select * from XXX表 where 学号='" & strcomp & "'",cn'调用open方法来执行SQL语句,其中cn为连接对象这样就可以根据文本框中的数据来查询了。