PDA

View Full Version : Setting DSN attribute with a Property



dfling
07-23-2002, 07:16 PM
I am trying to set the server attribute for my ODBC DSN with a property so the user can select the server our database will attach to. I set the server attribute to a property [SQLSERVERPROP] and then I set this property to a default value in the property manager. When I call MsiSetProperty in OnFirstUIBefore the property does not change. If I do not declare the property in the property manager I get a 1919 error. Does anyone have an idea why this might not work? I would like to avoid manually writing to the registry, but if that is my only choice so be it.

TIA,

Dan Fling

TommyBoy
08-02-2002, 04:32 AM
I had the same problem over and over again...

The mistake that I made was that the property I used was not public. Public properties are UPPERCASE and now I changed that it works.

That means in the ODBC Resources table:
Server: [ODBCSERVER]

Function called in the script:
svName = "my server";
MsiSetProperty(ISMSI_HANDLE, "ODBCSERVER", svName);


hope I could help you

Tommy

cbhunni
06-02-2003, 09:03 AM
hello dfling,

Did you ever get past the 1919 error?

thanks,
cbhunni :)

dfling
06-03-2003, 11:32 AM
My problem was the placement of the code. OnFirstUIBefore did not seem to work so I moved where I called the msisetproperty. I created a custom action which set the property and placed it before InstallODBC in the execute sequence. As the other poster said the property must be in Caps to be public.