国产免费AV|泡泡玛特欧洲总部将设在伦敦|中文天堂网www新版资源在线|一本久道综合在线中文|国精产品一二三产区的使用方法|香蕉鱼在线观看|www.27eee

ELEOK

標題: winccl與ORACLE [打印本頁]

作者: sonypower    時間: 2016-7-8 22:23
標題: winccl與ORACLE
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






歡迎光臨 ELEOK (http://m.afoofa.cn/) Powered by Discuz! X5.0