Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to Oracle From VB 6.0 with ADO

Status
Not open for further replies.

MavrickStl

Programmer
Feb 20, 2001
71
US
Does anybody know how to connect to Oracle From VB 6.0 with ADO.

Mavrick
 
Mavrick,

Reference the Oracle / MS for Oracle driver in your project references.

Here is some example code:

Dim objOracleADOConn As New ADODB.Connection
Dim objOracleADOcmdF As New ADODB.Command

objOracleADOConn.Open "Provider=msdaora; Data Source=" & strOracleSN & ";" & _
"User Id=" & strUserID & "; Password=" & _
strPassword & ";"


objOracleADOcmdF.CommandText = "AddFund"
objOracleADOcmdF.CommandType = adCmdStoredProc
Set objOracleADOcmdF.ActiveConnection = objOracleADOConn
objOracleADOcmdF.Parameters.Append _
objOracleADOcmdF.CreateParameter("P_OLYID", adVarChar, adParamInput, 10)
objOracleADOcmdF.Parameters.Append _
objOracleADOcmdF.CreateParameter("P_WKN", adVarChar, adParamInput, 20)

objOracleADOcmdF("P_OLYID") = objDB2ADORecordSet.Fields("SECCDE")

objOracleADOcmdF("P_WKN") = objDB2ADORecordSet.Fields("FWKN")
objOracleADOcmdF("P_ISIN") = objDB2ADORecordSet.Fields("FISIN")
objOracleADOcmdF("P_SECURITY_NAME") = objDB2ADORecordSet.Fields("FSECNAM")

objOracleADOcmdF.Execute

This code defines the stored procedure (SP) AddFund, declares the parameters, sets the parameter values( note these are from another ADO record source AS400 DB2 which had to be set up too) and them calls the SP.

Hope this helps.



Bill Paton
william.paton@ubsw.com

Check out
 
If you have further questions regarding VB front-ends for Oracle databases using ADO or OO4O...heres a GREAT book:

"Visual Basic Oracle 8 Programmer's Reference" authored by Dov Trietsch and published by Wrox.

Kelly St. John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top