Learn when you want, where you want with convenient online training courses. Sign up now!
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
'Oracle connection variables
Dim dbUserName As String
Dim dbPassword As String
dbUserName = "ORACLE_USERNAME"
dbPassword = "ORACLE_PASSWORD"
Dim dbDSN As String
dbDSN = "MY_TNS_ALIAS"
'Create and Set Session / Create Dynaset = Column Names
Dim OraSession As Object
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Dim OraDatabase As Object
Set OraDatabase = OraSession.OpenDatabase("" & dbDSN & "", "" & dbUserName & " / " & dbPassword & "", 0&)
Dim Oradynaset As Object
Set Oradynaset = OraDatabase.DBCreateDynaset("SELECT * FROM MY_ORACLE_TABLE", 0&)
'Upload data variables
Dim site As String
Dim item As String
order_id = 1
'Iterate through each cell and upload to MY_ORACLE_TABLE
Do Until Selection.Value = ""
site = ActiveCell.Value
item = ActiveCell.Offset(0, 1).Value
'Add new record
Oradynaset.Fields("USERNAME").Value = Application.UserName
Oradynaset.Fields("SITE").Value = site
Oradynaset.Fields("ITEM").Value = item
order_id = order_id + 1
Open in new window
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.