| 发表于:2007-07-14 16:07:562楼 得分:0 |
dim strusername as string '用户名 dim struserpwd as string '用户密码 dim l_cnn as adodb.connection '数据库连接对象 dim l_strsql as string '查询sql语句 dim l_rs as adodb.recordset '记录集对象 set l_rs = new adodb.recordset set l_cnn = new adodb.connection '连接数据库 l_cnn.connectionstring = "provider=msdaora.1;password=pppp;user id=uuuu;data source=sqlpath;persist security info=true " " " l_cnn.commandtimeout = 30 '30内连接数据库。 l_cnn.open '连接 l_strsql = "select username,password from user where username= '你的用户名 ' " err.clear set l_rs = g_cnnmain.EXECute(l_strsql) strusername = " " struserpwd = " " if not (l_rs.eof and l_rs.bof) then '查询结果没有到文件尾,说明已找到记录 strusername = trim(l_rs.fields( "username ").value) '取用户帐号 struserpwd = trim(l_rs.fields( "password ").value) '取用户密码 end if if len(trim(strusername)) = 0 then msgbox "未找到 " else msgbox "用户名: " & strusername & " 密码: " & struserpwd end if '释放内存 if not l_rs is nothing then if l_rs.state = adstateopen then l_rs.close set l_rs = nothing end if | | |
|