|
本帖最后由 yidao8808 于 2011-8-22 09:45 编辑
回复 2# mizhe521
Dim Cnn
Dim Rst
Dim strCnn
Set Cnn = CreateObject("ADODB.Connection")
Set Rst =CreateObject("ADODB.Recordset")
strCnn="provider=OraOLEDB.Oracle.1;Data Source=xxx;password=xxx;User ID=xxx; Security Info=True;"
Cnn.Open strCnn
If Cnn.State=0 Then
Reporter.ReportEvent micFail,"testing","数据库连接失败"
else
Reporter.ReportEvent micPass, "testing","数据库连接成功"
End If
msgbox Cnn.State
If Cnn.Open<>0 Then
strsql="select * from pets"
Rst.Open strsql,Cnn
ydl=Rst("name")
msgbox ydl
Set Rst=nothing
Cnn.Close
End If |
|