We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

How do I read and capture database information to an XML file?

Hi,

I would like to read an existing xml file (if it exists)

Gather Database information using the SQLServerConnectionDialog

Finally, write out the database information to the xml file

I have attached a project that I have started... but I can't detect the xml file... nor will it write out the new settings

Can you help me out?

Thanks
Mike
Attachments
DBAccessTest.zip
(10.93 KiB) Downloaded 251 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How do I read and capture database information to an XML file?

Hello Mike,

To search for an element within the XML file you can use an XML Search. If you need only to check if the XML file exists, then you can simply use a File Search.

Your XML file update seems to be configured fine, but I suggest you instead of using private property name (i.e. DB_Server, DB_TrustedConnection, DB_UserName, etc.) you should use public property names (e.g. DB_SERVER, DB_TRUSTEDCONNECTION, etc). This is because the values of private properties get reset when the installation moves from "Wizard Dialogs Stage" to "Install Execution Stage".

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

Re: How do I read and capture database information to an XML file?

Daniel,

Thanks for the help... I have changed them to "public" and it's writing out the values now..

but

here is the file:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manager>
<DB>
<Server _Server="LAPTOP3080\SQL_EXPRESS">This is the DB Server name</Server>
</DB>
</Manager>

What I need is to put the "value" into xmlElement instead of an attribute

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manager>
<DB>
<Server>LAPTOP3080\SQL_EXPRESS</Server>
</DB>
</Manager>

How is this achieved ?

Thannks
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How do I read and capture database information to an XML file?

Hello Mike,

To achieve this you should only use your a formatted reference of your server property in the "Text" section of your XML element.
printscreen.jpg
printscreen.jpg (72.7 KiB) Viewed 4114 times
If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How do I read and capture database information to an XML file?

You're always welcome.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”