標題: winccl與ORACLE [打印本頁] 作者: sonypower 時間: 2016-7-8 22:23 標題: winccl與ORACLE Dim objTag
Dim strConnectionString
Dim strSQL
Dim lngCount
Dim lngValue
Dim objConnection, objRecordset, objCommand
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