G
Guest
Does anybody know how to run a insert query through excel vb using microsoft ODBC for oracle
I made de code below but it dosen't works
Dim GDW As Object ' Database Objec
Dim LOCAL_DW As Object ' Database Objec
Dim gdbEngine As Object ' DB Engin
Dim gwsp As Object ' Workspac
Dim sql_data As Objec
Dim Const idbOPENDYNASET =
Dim Const idbOPENSNAPSHOT =
Dim Const idbSQLPASSTHROUGH = 6
Dim Const idbSQLINCONSISTENT = 1
Dim Const ixlMANUAL = -413
'create work spac
If (Left(application.Version, 1) = 7) The
Set gdbEngine = CreateObject("DAO.DBEngine") ' Excel 9
Els
If (Left(application.Version, 1) = 8) The
Set gdbEngine = CreateObject("DAO.DBEngine.35") ' Excel 9
Els
Set gdbEngine = CreateObject("DAO.DBEngine.36") ' Excel 200
End I
End I
'define worksapc
Set gwsp = gdbEngine.Workspaces(0
'connect databas
' The ODBC used here is the microsoft ODBC for oracl
Set LOCAL_DW = gwsp.OpenDatabase("", False, False, "ODBC;DSN=" & Local_DW_DSN & ";UID=" & Local_DW_user & ";PWD=" & Local_DW_user_psw & ";SERVER=" & Local_DW_Server & ""
'set insert sq
sql = "insert into bi_fin_stg_valor_calc_gdw Values ('200310', '00593', 'K1000',-914099.59,0,0,0, SYSDATE , 'boasrm')
run sql statmen
Set sql_data = LOCAL_DW.OpenRecordset(SQL, idbOPENDYNASET, idbSQLPASSTHROUGH)
I made de code below but it dosen't works
Dim GDW As Object ' Database Objec
Dim LOCAL_DW As Object ' Database Objec
Dim gdbEngine As Object ' DB Engin
Dim gwsp As Object ' Workspac
Dim sql_data As Objec
Dim Const idbOPENDYNASET =
Dim Const idbOPENSNAPSHOT =
Dim Const idbSQLPASSTHROUGH = 6
Dim Const idbSQLINCONSISTENT = 1
Dim Const ixlMANUAL = -413
'create work spac
If (Left(application.Version, 1) = 7) The
Set gdbEngine = CreateObject("DAO.DBEngine") ' Excel 9
Els
If (Left(application.Version, 1) = 8) The
Set gdbEngine = CreateObject("DAO.DBEngine.35") ' Excel 9
Els
Set gdbEngine = CreateObject("DAO.DBEngine.36") ' Excel 200
End I
End I
'define worksapc
Set gwsp = gdbEngine.Workspaces(0
'connect databas
' The ODBC used here is the microsoft ODBC for oracl
Set LOCAL_DW = gwsp.OpenDatabase("", False, False, "ODBC;DSN=" & Local_DW_DSN & ";UID=" & Local_DW_user & ";PWD=" & Local_DW_user_psw & ";SERVER=" & Local_DW_Server & ""
'set insert sq
sql = "insert into bi_fin_stg_valor_calc_gdw Values ('200310', '00593', 'K1000',-914099.59,0,0,0, SYSDATE , 'boasrm')
run sql statmen
Set sql_data = LOCAL_DW.OpenRecordset(SQL, idbOPENDYNASET, idbSQLPASSTHROUGH)