In Visual Studio 2008 professional, Right click solution -> Add new item -> SQL server database. This creates the database.mdf file in the folder.
What database is this? Is it MS SQL server? If so, which version?How to set up username/password in the database?
The database gets connected automatically without specifying any username/password. How to avoid this and include security authentication?
Also I am developing a 开发者_运维技巧website in it and I am going to use database in it. After I finish the site, how to I recreate the database on the deployment server? (Website files can be published. What happens to the database created here? Does it create a database creation script or something?)
PS: Newbie :)(1) The database created by using Right click solution -> Add new item -> SQL server database
is a SQL Server 2005 Database.
(2) By default it uses Windows Authentication, so you won't be required to enter username & password.
(3) If you want to ensure that the database is accessed using username & password only, then you need to install SQL Server 2005 with 'Mixed Mode Authentication'.
(Probably you can uninstall SQL Server 2005 from your Control Panel and then again Install SQL Server 2005. During installation, select "Advanced Options" and you will get an option to select the authentication mode.)
To change security authentication mode
- In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
- On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
- In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
To enable the sa login by using Transact-SQL
ALTER LOGIN sa ENABLE ;
GO
ALTER LOGIN sa WITH PASSWORD = '<enterStrongPasswordHere>' ;
GO
Hope this helps.
SQL Server 2005 developer edition comes with Visual Studio 2008 professional. You should have a separate disk to install this. I think if you don't install the SQL Server 2005 developer edition before Visual Studio 2008 professional, VS2008 will install SQL Server Express as part of it's installation.
精彩评论