Hello Chris,
Based on your description, you're building a setup program for your
application and you would like to do some intialization(create table, view,
sps ...) in the new created database. You're wondering what's the best
means to do it, correct?
I think your current choice on using custom action to manipulate the
database is reasonable. As far as I know, for such intialization of
database(SQL Server 2005) in custom action, we can use one of the following
means:
1. Use SQL 2005 SMO to manipulate an installed database of a certain server
instance. SMO is naturally .net based which would be easy to use in .net
code.
2. Use ADO.NET code to connect the database and executring t-sql statements
3. Programmaticaly attach a prepared database file into the given server
instance.
I think if the database structure and the components contained in it are
not very complex, using the #1 and #2 would be preferred. And I've seen
many MSDN sample application use the #2 to setup sample database. #3 is
very convenient to do(e.g through SMO call), however, it will require your
setup to embed the database file, if the extra database file size won't be
critical for your setup program, using #3 will save lots of code or
scripts. How do you think?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx. ==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.