| 发表于:2007-05-08 13:55:16 楼主 |
const gstrconn as string = "provider=microsoft.jet.oledb.4.0;password= " " " ";user id=admin;data source=d:\jcxt.mdb;persist security info=false " private sub cmd1_click() dim strsql as string dim conn as new adodb.connection dim rs as new adodb.recordset strsql = " select [riqi] from chuchaxt where [chuno] = ' " & text1.text & " ' " if connectdb(conn, gstrconn, 60) <> vbtrue then exit sub rs.open strsql, conn, adopenstatic if not rs.eof then text2.text = rs.fields(0) text3.text = rs.fields(2) end if rs.close set conn = nothing end sub public function connectdb(byref conn as adodb.connection, byval strconnstring as string, connectiontimeout as long) on error goto moddb_connectdb_error set conn = new adodb.connection if conn.errors.count > 0 then set conn = nothing end if if (connectiontimeout <> -1) then conn.connectiontimeout = connectiontimeout end if conn.open strconnstring connectdb = vbtrue exit function moddb_connectdb_error: set conn = nothing connectdb = vbfalse end function 为什么点cmd1时只能查询一个字段???谢谢了?? |
|
|
|
|