Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
dhavalvyas
Contributor III
Contributor III

Macros code not understood

can anyone explain me following macros code ? I am not understanding where to enter database name,where to create database connection,where to enter table name and where to enter field name ?

Sub DBWriteback

dim sConn, oConn

Set oConn = CreateObject("ADODB.Connection") //database connection

sConn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Test1;Data Source=PIO-MIDB-V99;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=BMS088;Use Encryption for Data=False;Tag with column collation when possible=False"

oConn.Open sConn

set val=ActiveDocument.Fields("Team1").GetPossibleValues //field name

set val2=ActiveDocument.Fields("Team2").GetPossibleValues//field name

for i=0 to val.Count-1

Connection.Execute "INSERT INTO QVTable //table in which data is to be enter (Team1, Team2) VALUES ('" & val.Item(i).Text & "', '" & val2.Item(i).Text & "')"

next

oConn.Close

Set oConn = Nothing

End Sub

0 Replies