楼上的朋好友,Oracle Provider for ole db 的确可以,但是如果oracle安装的是客户端,Oracle Provider for ole db是没有的。 Miscrosoft Ole Db Provider for Oracle 通用一点,我听说是注册表的问题,不知道该如何解决
<& ------ LINK ORACLE Function GetOracleConnStr() GetOracleConnStr ="Provider=MSDAORA.1;Password=;Persist Security Info=True;User ID=;Data Source=DATABASE" End Function ----------LINK SQL SERVERFunction GetDATABASEConnStr() GetDATABASEConnStr = "Provider=SQLOLEDB.1;Password=1234;Persist Security Info=True;User ID=USER;Initial Catalog=DATABASE;Data Source=." End Function %>
ADO Program Dim Con As New ADODB.Connection Dim Rst1 As New ADODB.Recordset Dim Rst2 As New ADODB.Recordset Dim Rst3 As New ADODB.Recordset Dim Cmd As New ADODB.Command Dim Prm1 As New ADODB.Parameter Dim Prm2 As New ADODB.Parameter Con.Provider = "OraOLEDB.Oracle" Con.ConnectionString = "Data Source=MyOraDb;" & _ "User ID=scott;Password=tiger;" Con.Open Cmd.ActiveConnection = Con' Although Employees.GetEmpRecords() takes four parameters, only ' two need to be bound because Ref cursor parameters are automatically ' bound by the provider. Set Prm1 = Cmd.CreateParameter("Prm1", adSmallInt, adParamInput, , 30) Cmd.Parameters.Append Prm1 Set Prm2 = Cmd.CreateParameter("Prm2", adSmallInt, adParamOutput) Cmd.Parameters.Append Prm2 ' Enable PLSQLRSet property Cmd.Properties ("PLSQLRSet") = TRUE ' Stored Procedures returning resultsets must be called using the ' ODBC escape sequence for calling stored procedures. Cmd.CommandText = "{CALL Employees.GetEmpRecords(?, ?)}" ' Get the first recordset Set Rst1 = Cmd.Execute ' Disable PLSQLRSet property Cmd.Properties("PLSQLRSet") = FALSE ' Get the second recordset Set Rst2 = Rst1.NextRecordset' Just as in a stored procedure, the REF CURSOR return value must ' not be bound in a stored function. Prm1.Value = 7839 Prm2.Value = 0' Enable PLSQLRSet property Cmd.Properties("PLSQLRSet") = TRUE ' Stored Functions returning resultsets must be called using the ' ODBC escape sequence for calling stored functions. Cmd.CommandText = "{CALL Employees.GetDept(?, ?)}" ' Get the rowset Set Rst3 = Cmd.Execute ' Disable PLSQLRSet Cmd.Properties ("PLSQLRSet") = FALSE' Clean up Rst1.Close Rst2.Close Rst3.Close
Miscrosoft Ole Db Provider for Oracle 通用一点,我听说是注册表的问题,不知道该如何解决
http://www.delphibbs.com/delphibbs/dispq.asp?lid=2889791
------ LINK ORACLE
Function GetOracleConnStr()
GetOracleConnStr ="Provider=MSDAORA.1;Password=;Persist Security Info=True;User ID=;Data Source=DATABASE"
End Function ----------LINK SQL SERVERFunction GetDATABASEConnStr()
GetDATABASEConnStr = "Provider=SQLOLEDB.1;Password=1234;Persist Security Info=True;User ID=USER;Initial Catalog=DATABASE;Data Source=."
End Function
%>
Dim Con As New ADODB.Connection
Dim Rst1 As New ADODB.Recordset
Dim Rst2 As New ADODB.Recordset
Dim Rst3 As New ADODB.Recordset
Dim Cmd As New ADODB.Command
Dim Prm1 As New ADODB.Parameter Dim Prm2 As New ADODB.Parameter Con.Provider = "OraOLEDB.Oracle"
Con.ConnectionString = "Data Source=MyOraDb;" & _
"User ID=scott;Password=tiger;"
Con.Open
Cmd.ActiveConnection = Con' Although Employees.GetEmpRecords() takes four parameters, only
' two need to be bound because Ref cursor parameters are automatically
' bound by the provider. Set Prm1 = Cmd.CreateParameter("Prm1", adSmallInt, adParamInput, , 30)
Cmd.Parameters.Append Prm1
Set Prm2 = Cmd.CreateParameter("Prm2", adSmallInt, adParamOutput)
Cmd.Parameters.Append Prm2 ' Enable PLSQLRSet property
Cmd.Properties ("PLSQLRSet") = TRUE ' Stored Procedures returning resultsets must be called using the
' ODBC escape sequence for calling stored procedures.
Cmd.CommandText = "{CALL Employees.GetEmpRecords(?, ?)}" ' Get the first recordset
Set Rst1 = Cmd.Execute ' Disable PLSQLRSet property
Cmd.Properties("PLSQLRSet") = FALSE ' Get the second recordset
Set Rst2 = Rst1.NextRecordset' Just as in a stored procedure, the REF CURSOR return value must
' not be bound in a stored function.
Prm1.Value = 7839
Prm2.Value = 0' Enable PLSQLRSet property
Cmd.Properties("PLSQLRSet") = TRUE ' Stored Functions returning resultsets must be called using the
' ODBC escape sequence for calling stored functions.
Cmd.CommandText = "{CALL Employees.GetDept(?, ?)}" ' Get the rowset
Set Rst3 = Cmd.Execute ' Disable PLSQLRSet
Cmd.Properties ("PLSQLRSet") = FALSE' Clean up
Rst1.Close
Rst2.Close
Rst3.Close