Friday, March 9, 2012

How to deploy asp.net project with sql database?

I finished a web application, it need sql database support.
I made a deploy project and it work perfect to create a visual directory on target machine. But I need create and config the sql server database manually.

My question is how to make a deploy project which can let user input sql user and password, then create sql server database and write down the connection information to web.config file?

I see some Microsoft sample's setup can do that. Any body know how to do?

Thanks.You need to do it manually or buy a 3rd party tool. "InstallShield X" reports to do that.|||Thank you for your answer.
I want to do it manually, but I don't know how to create SQL Database in my code.
I can build an application, after install, I can launch this app, and let user input all information, then I need create db, how I create db in code? use script or API ?
Could you tell me a sample to do that?|||You can use either technique. Personally I prefer to have API control over the actual creation and config of the raw database. So SQLDMO there. For creating the entities within the database then I'd use scripts, esp. easy since you can script them all with a couple of clicks in Enterprise Manager.
The SQLDMO COM code is quite verbose but look out for...


SQLDMO.SQLServer
SQLDMO.Database
SQLDMO.DBFile
SQLDMO.DBLogFile
|||you can also import the script into the codebase, and execute it through the application if you have the sa access rights to do so.

There's many ways to do this.|||I can see pros & cons with both approaches. If you use Install Shield X, I'm sure that also wraps the scripts up as well. I'd prefer to keep the script outside the codebase so it can be maintained without DLLs but whatever floats your database boat.|||I am very help that so many people answer my question. I think I know how to do it now. Thanks a lot.

No comments:

Post a Comment