SQL Insert Statement - Advanced Installer Community
skingswell
Posts: 29
Joined: Tue Nov 29, 2016 2:24 pm

SQL Insert Statement

I am managing to find my way around AI quite well but there is one thing that I cannot work out. I have searched and searched but do not find the answer to this problem...

I need to execute a SQL INSERT Statement but the statement would be based a particular property value set at install

How would I do this. I am thinking I may need a VBScript to do this as I cannot include property names in my SQL Insert query?
skingswell
Posts: 29
Joined: Tue Nov 29, 2016 2:24 pm

Re: SQL Insert Statement

I have very little knowledge of vbscripts but I can get the script to create a record in my table if I replace the property value with a fixed value but I must be doing something wrong when setting the variable and referencing the property value from AI. Any help greatly appreciated....

dim conn, insertSQL, str
set conn = createobject("ADODB.Connection")
set str = Session.Property("BROWSE_DATABASE_LISTBOX")
conn.open "dsn=APS;uid=username;pwd=password;database=pubs"
conn.execute("insert into TestTable values(str,'2')")

conn.close
set conn = nothing
skingswell
Posts: 29
Joined: Tue Nov 29, 2016 2:24 pm

Re: SQL Insert Statement

Ignore this... I have just found the Script Replacement Option that addresses my issue!!!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: SQL Insert Statement

Hi,

Indeed, the Script Replacements feature is the one that you need. I'm glad you solved the issue.

Just let us know anytime you need assistance.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”