| 发表于:2007-04-17 23:13:425楼 得分:0 |
vb中引用:microsoft activex data objects 2.0 library 数据库中:2个表 school 和 student school表中 id,name student表中 id,name 模块 public strconnection as string public conn as adodb.connection public rs as recordset public strqry as string '启动过程 sub main() dim strapppath as string strapppath = "c:\data.mdb " strconnection = "driver=microsoft access driver (*.mdb);dbq= " & strapppath & "; " '打开连接 set conn = new connection set rs = new recordset with conn .connectionstring = strconnection .cursorlocation = aduseclient .commandtimeout = 30 .open end with form1.show exit sub end sub form1: 显示学校 strqry = "select * from school order by id " set rs = getrecordset(conn, strqry) list1.clear while not rs.eof list1.additem rs!name rs.movenext wend list1_click strqry = "select * from student where name= ' " & list1.text & " ' order by id " set rs = getrecordset(conn, strqry) list2.clear while not rs.eof list2.additem rs!name rs.movenext wend 没测试,应该可以 | | |
|