Dim objTag
Dim strConnectionString
Dim strSQL
Dim lngCount
Dim lngValue
Dim objConnection, objRecordset, objCommand
Const hostName = "192.168.0.211"
Const portNo = "1522"
Const srvSID = "ORCL"
Const usrID = "ID"
Const usrPwd = "PASS"
strDriver = "Driver={Microsoft ODBC for Oracle};"
strParams = "CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=" + hostName + ")(PORT=" + portNo + "))(CONNECT_DATA=(SID=" + srvSID + ")));"
strUser = "UID=" + usrID + ";PWD=" + usrPwd + ";"
strConnectionString = strDriver + strParams + strUser
strConnectionString = "Provider=MSDASQL;DSN=orclConnect;UID=ID;PWD=PASS"
strSQL = "select score from test where name = 'NAME'"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set objRecordset = CreateObject("ADODB.Recordset")
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = strSQL
Set objRecordset = objCommand.Execute
lngCount = objRecordset.Fields.Count
If (lngCount > 0) Then
objRecordset.movefirst
lngValue = objRecordset.Fields(0).value
End If
Set objCommand = Nothing
objConnection.Close
Set objRecordset = Nothing
Set objConnection = Nothing
【必讀】版權免責聲明
1、本主題所有言論和內容純屬會員個人意見,與本論壇立場無關。2、本站對所發內容真實性、客觀性、可用性不做任何保證也不負任何責任,網友之間僅出于學習目的進行交流。3、對提供的數字內容不擁有任何權利,其版權歸原著者擁有。請勿將該數字內容進行商業交易、轉載等行為,該內容只為學習所提供,使用后發生的一切問題與本站無關。 4、本網站不保證本站提供的下載資源的準確性、安全性和完整性;同時本網站也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的損失或傷害。 5、本網站所有軟件和資料均為網友推薦收集整理而來,僅供學習用途使用,請務必下載后兩小時內刪除,禁止商用。6、如有侵犯你版權的,請及時聯系我們(電子郵箱1370723259@qq.com)指出,本站將立即改正。
|