cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Pascha
Level 3

Accessing Databases and doing a new entry

Hi everyone I am trying out the new IS 2010 for my current project.

What I want to do is to access an instance of database on the computer that the program is being installed and get some parameters from the database into a combobox in a dialog then user will make choices and enter some data and then I need to take those data and enter it into the database as a new entry.

Now I know this can be done with a C++ dll scripts but I wanted to know if it can be done with a C# script or is there a feature like this built into IS 2010
Labels (1)
0 Kudos
6 Replies
timstspry
Level 7

Pascha, you can do this in managed code assemblies. So, you can write in C#, VB.NET, etc. and execute the CLR assembly from a Custom Action within InstallShield. There are sample projects regarding how to do this included in IS2010. Not sure about if this is built-into IS2010 outside of the standard SQL dialogs which allow you to collect basic information like server, userid, password, database etc.

Hope this helps!

Tim
0 Kudos
Pascha
Level 3

Thanks for the reply it was helpful.

So now I am writing the dll for this and I have a problem with the functions. I try the MsiRecordGetString to get the entire data from a column but I can't do it I guess. I used MsiDatabaseOpenView function to open the view and used MsiViewExecute and MsiViewFetch functions before but it's not happening. Should I use SQLGetData function or is it not needed.
0 Kudos
timstspry
Level 7

Pascha, I actually use SQL Server Management Objects in VB.NET to take care of the database side of things. I use the InstallShield SQLLogin dialog box to authenticate the user and have them select the server and database. You may have to develop a custom dialog box to get whatever information from the user you are looking for and pass that information as parameters in your Managed Code Custom Action to the assembly you are writing.

Were you able to locate the examples within InstallShield and locate the Managed Custom Actions examples? This is what helped me figure out how to do this.

Tim
😄
0 Kudos
Pascha
Level 3

I am not using VB.NET I am using C++ to make the dll file and as I said above I can't get those functions to work most of the examples I found are in VB.NET so can anyone help me with C++?
0 Kudos
tenebrae
Level 4

Pascha wrote:

What I want to do is to access an instance of database on the computer that the program is being installed and get some parameters from the database into a combobox in a dialog then user will make choices and enter some data and then I need to take those data and enter it into the database as a new entry.


I see some disambiguation here, especially with regard to your later post about attempts to use MSI functions: do you mean a MSI database, or some external SQL or other type of database? MSI functions are for operations on MSI database. For operations on other type of databases you need appropriate API to use.

By the way - what type of InstallShield project do you use?

Regards,

tene
0 Kudos
Pascha
Level 3

Hmm I want to access an SQL database not an MSI one so for that I can't use MSI functions so what should I use instead?

I am using Basic MSI Project.
0 Kudos