kietvta
Posts: 16
Joined: Thu Dec 08, 2016 8:44 am

Run script to insert data to SQL Sever CE

Dear Sir

My deployment connect to SQL Sever CE. It had already extracted file .sdf to installed folder automatically.
Now I want to insert data to some tables in that database.
Would you mind to show me how to create script file to connect to SQL Sever CE automatically
and get data from users input on the initial setup (I have designed Folder Dialog to get data) to insert data to some table


Thank you so much.

Regards,

Kietvta
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Run script to insert data to SQL Sever CE

Hello Kietvta,

To configure a script using installer properties(e.g. public properties attached to UI controls), you can follow this article:
How to use a custom property in a SQL script?

Also, you can find related step by step tutorials here:
Using SQL Databases tutorials

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kietvta
Posts: 16
Joined: Thu Dec 08, 2016 8:44 am

Re: Run script to insert data to SQL Sever CE

Dear Mihai

Thank you for your reply.

What is the connection string to connect to SQL SERVER CE database?
I made custom connection by go to "SQL database -> database server -> new connection -> custom as image attached here.

Regard,


Kietvta
Attachments
CUSTOM CONNECTION.png
CUSTOM CONNECTION.png (22.61 KiB) Viewed 18596 times
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Run script to insert data to SQL Sever CE

Hello Kietvta,

Depending on the data provider, you can configure SQL Server CE connection strings as indicated here:
SQL Server Compact connection strings

To do this you can still use a custom connection type, but instead of the standard SQL connection string, try one from the article linked above. The custom connection string field is also formatted type so you can still reference installer properties.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kietvta
Posts: 16
Joined: Thu Dec 08, 2016 8:44 am

Re: Run script to insert data to SQL Sever CE

Hi Mihai
Thank you so much for your support.

Return to “Common Problems”