Hello everyone,
I managed to make a code to access DataWarehouse, and set some SQL queries but I dont know how to export/show the result of the query.
Below is the code to access the database, and to run the sql query, but I cant export the result. Any help about this?
I managed to make a code to access DataWarehouse, and set some SQL queries but I dont know how to export/show the result of the query.
Below is the code to access the database, and to run the sql query, but I cant export the result. Any help about this?
Public Sub access_XXX()
Dim cn As ADODB.Connection
Dim scs As String
Dim vSql As String
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Scs="DSN=XXX;UID=XXX;PWD=XXX;DBQ=XXX;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BNF=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;MLD=0;ODA=F;STE=F;TSZ=8192;"
cn.ConnectionString = scs
cn.Open
vSql = "XXXXXXXXX(*) from aru_flt.flt partition (pflt20171205) group by fXXXX_ad order by 2 desc"
cn.Execute (vSql)
Set rs = cn.Execute(vSql)
rs.MoveFirst
Do While rs.EOF = False
Text = rs.Fields("flt_dep_ad").Value
Loop
cn.Close
End Sub
Dim cn As ADODB.Connection
Dim scs As String
Dim vSql As String
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Scs="DSN=XXX;UID=XXX;PWD=XXX;DBQ=XXX;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BNF=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;MLD=0;ODA=F;STE=F;TSZ=8192;"
cn.ConnectionString = scs
cn.Open
vSql = "XXXXXXXXX(*) from aru_flt.flt partition (pflt20171205) group by fXXXX_ad order by 2 desc"
cn.Execute (vSql)
Set rs = cn.Execute(vSql)
rs.MoveFirst
Do While rs.EOF = False
Text = rs.Fields("flt_dep_ad").Value
Loop
cn.Close
End Sub