What is the best method to mount SQL Server Express .mdf file in an installer?

Thank you Scott for your excellent question. Ensure that SQLExpress has read, write, modify access to the deployment folder which contains the datafile. Next you need to make sure that all users who access your application may modify the data.

You could grant full access, but this is not advised. Instead create a local SQL user account and grant the user the ability to modify your database. Next ensure that the SQL instance has been set up to a mixed mode login By: USE master " & _ "EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2 The above will create that log file if the SQL users have the ability to modify the directory!

Now grant the user created By: CREATE Login UName WITH PASSWORD = 'UPassword', DEFAULT_DATABASE=MyDatabase, CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF; " & _ "exec sp_addsrvrolemember N'UName', sysadmin Now add that user to all the roles you wish, example: USE MyDatabase " "EXEC sp_addrolemember N'db_datareader', N'User There are other actions which you may choose to take on the user. But this depends on what your trying to accomplish The last step is to connect your application using this new account by: Connection string: Data Source=***********\SQLEXPRESS;AttachDbFilename=****\Datafile. Mdf;Initial Catalog=MyDatabase;Persist Security Info=True;User ID=UNAME;Password=UPassword.

Thank you Scott for your excellent question. Ensure that SQLExpress has read, write, modify access to the deployment folder which contains the datafile. Next you need to make sure that all users who access your application may modify the data.

You could grant full access, but this is not advised. Instead create a local SQL user account and grant the user the ability to modify your database. Next ensure that the SQL instance has been set up to a mixed mode login By: "USE master " & _ "EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2 " The above will create that log file if the SQL users have the ability to modify the directory!

Now grant the user created By: "CREATE Login UName WITH PASSWORD = 'UPassword', DEFAULT_DATABASE=MyDatabase, CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF; " & _ "exec sp_addsrvrolemember N'UName', sysadmin; " Now add that user to all the roles you wish, example: "USE MyDatabase " "EXEC sp_addrolemember N'db_datareader', N'User' " There are other actions which you may choose to take on the user. But this depends on what your trying to accomplish. The last step is to connect your application using this new account by: Connection string: Data Source=***********\SQLEXPRESS;AttachDbFilename=****\Datafile.

Mdf;Initial Catalog=MyDatabase;Persist Security Info=True;User ID=UNAME;Password=UPassword.

I should say "The above will create that log file if the SQL users have the ability to modify the directory! " The act of executing that code as the administrator at run time will create the log file ;).

Ensure that SQLExpress has read, write, modify access to the deployment folder which contains the datafile. Next you need to make sure that all users who access your application may modify the data. You could grant full access, but this is not advised.

Instead create a local SQL user account and grant the user the ability to modify your database. The above will create that log file if the SQL users have the ability to modify the directory! There are other actions which you may choose to take on the user.

But this depends on what your trying to accomplish.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions