database selection in deployment

L

Leanne

I created customized application to Microsoft POS system. I am now
working on the installation package. Any one knows how to get the local
sql database settings, and get user select database, so I can make
necessary changes to the database ( create new tables, update some
records etc.) to make my application work properly.

Thanks
Leanne
 
R

Robinson

Leanne said:
I created customized application to Microsoft POS system. I am now
working on the installation package. Any one knows how to get the local
sql database settings, and get user select database, so I can make
necessary changes to the database ( create new tables, update some
records etc.) to make my application work properly.

Thanks
Leanne

Hi,

Microsoft POS uses MSDE 2000. You can query a given server for all
instances of SQL Server using a combination of registry enumeration (for
local instances) and SMO EnumerateAllSQLServers for remote servers. Once
your user has chosen a candidate (from a list), you can then enumerate all
databases on the server using the stored procedure "sp_Databases", allowing
the user to choose one. Alternatively you can setup a registry key with a
default server/instance and catalog name and read that when your application
starts, allowing the user to change it using the previously mentioned
enumeration methods to populate selection list boxes.

It's also sometime useful to have a default stored procedure to call to
check to see if the selected database is compatible with your application.
I use a "Version" stored procedure, that returns a version record that
returns a GUID along with other information, so I know whether or not I'm
dealing with a database related to my application, or some other database
that just happens to be attached to the SQL server instance I'm using.


Hope this helps,


Robin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top