Hi. I would like to make an export from an Oracle database to excel but I do not know how. Could anyone please help me?
I have tried this:
[code=vb]
Public Function ExportOracleTab leToExcel(ByVal strTable As String, strSheetName As String, path_file_excel As String)
Dim SirSql As String
SirSql = ""
Dim prj_temp As String
prj_temp = ""
prj_temp = Trim(UCase(Form 1.txtPrjTempRap .Text))
Dim PrjTab As String ‘name of project and table
PrjTab = prj_temp & "." & strTable
Dim ConnOracleTemp As String
Dim ConnectOracleTe mp As New ADODB.Connectio n
Dim RS_Oracle_Temp As New ADODB.Recordset
ConnOracleTemp = "DSN=" & Form1.txtDSN.Te xt & "; Uid=" & Form1.txtUid.Te xt & "; Pwd=" & Form1.txtPwd.Te xt & ";"
ConnectOracleTe mp.CursorLocati on = adUseServer
ConnectOracleTe mp.Open (ConnOracleTemp )
SirSql = " SELECT * INTO " & path_file_excel & “ FROM " & PrjTab & " "
Debug.Print SirSql
ConnectOracleTe mp.Execute (SirSql)
ConnectOracleTe mp.Close
End Function
[/code]
but no luck. VB just crashes - VB has encountered a problem and needs to close.
Thank you!
I have tried this:
[code=vb]
Public Function ExportOracleTab leToExcel(ByVal strTable As String, strSheetName As String, path_file_excel As String)
Dim SirSql As String
SirSql = ""
Dim prj_temp As String
prj_temp = ""
prj_temp = Trim(UCase(Form 1.txtPrjTempRap .Text))
Dim PrjTab As String ‘name of project and table
PrjTab = prj_temp & "." & strTable
Dim ConnOracleTemp As String
Dim ConnectOracleTe mp As New ADODB.Connectio n
Dim RS_Oracle_Temp As New ADODB.Recordset
ConnOracleTemp = "DSN=" & Form1.txtDSN.Te xt & "; Uid=" & Form1.txtUid.Te xt & "; Pwd=" & Form1.txtPwd.Te xt & ";"
ConnectOracleTe mp.CursorLocati on = adUseServer
ConnectOracleTe mp.Open (ConnOracleTemp )
SirSql = " SELECT * INTO " & path_file_excel & “ FROM " & PrjTab & " "
Debug.Print SirSql
ConnectOracleTe mp.Execute (SirSql)
ConnectOracleTe mp.Close
End Function
[/code]
but no luck. VB just crashes - VB has encountered a problem and needs to close.
Thank you!
Comment