Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I have found a code to connect to Oracle using macro. Dint understan much in the code but its working fine. Code :- Public objSession As Object Public objDataBase As Object Dim strSQL As String Sub final() ConnectToOracle Worksheets("sheet2") End Sub Sub ConnectToOracle(ws1 As Worksheet) 'Create a reference to the OO4O dll Set objSession = CreateObject("OracleInProcServer.XOraSession") 'Create a reference to my database Set objDataBase = objSession.OpenDatabase("AshishDB" "username/password", 0&) For i = 2 To ws1.UsedRange.Rows.Count strSQL = "insert into zzz_ashish values('" + ws1.Cells(i, 1) + "','" CStr(ws1.Cells(i, 2)) + "')" objDataBase.ExecuteSQL (strSQL) Next i End Sub Regards, Ashis -- ashishpre ----------------------------------------------------------------------- ashishprem's Profile: http://www.excelforum.com/member.php...fo&userid=3148 View this thread: http://www.excelforum.com/showthread.php?threadid=54579 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
QUERY & HELP: so slow executing VBA code... :S | Excel Worksheet Functions | |||
QUERY & HELP: so slow executing VBA code... :S | Excel Programming | |||
Problem with MS Query - can't edit query | Excel Discussion (Misc queries) | |||
Problem executing a macro from different workbook where it is | Excel Discussion (Misc queries) | |||
Problem with .Background Query option of ODBC Query | Excel Programming |