cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
John_Farkas
Level 4

SQL Connection Properties

I am working with an InstallScript project.

My project uses OnSQLServerInitialize to get SQL Server connection information.
I need to get the IS_SQLSERVER_SERVER and IS_SQLSERVER_DATABASE properties after the OnSQLServerInitialize is finished so I can build and encrypt the connection string and then write to a web.config file.

My question is, how do I read the IS_SQLSERVER_SERVER and IS_SQLSERVER_DATABASE properties from InstallScript. I tried MSIGetProperty but I guess I can't use it from an InstallScript only project.

Any help would be greatly appreciated.
Labels (1)
0 Kudos
(4) Replies
hidenori
Level 17

Windows Installer properites are not available for InstallScript projects. In that project type, you need to call the SQLRTGetConnectionInfo() function to get connection information. Please refer to the default implementation of the OnSQLServerInitialize() event in order to find out how to use the function.
0 Kudos
John_Farkas
Level 4

Thanks for your reply.

I had tried the SQLRTGetConnectionInfo but couldn't get it to work. Here is what I had:

nResult = OnSQLServerInitialize( nResult );
if( nResult = BACK ) goto Dlg_SdFeatureTree;
SQLRTGetConnectionInfo(szDBConnection, szDBServer, szDBName, szDBUser, szDBPassword);

All the properties are empty after the function call. I also tried to get it to work by calling SQLRTInitialize2 first, but on reading the docs it said OnSQLServerInitialize calls that anyway.
0 Kudos
hidenori
Level 17

Did you set a correct connection name to szDBConnection?
0 Kudos
John_Farkas
Level 4

No I wasn't. That was the problem. Thanks for your help 🙂
0 Kudos