Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>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:</p> <pre><code>"USE [master] " &amp; _ "EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2 " </code></pre> <p>The above will create that log file if the SQL users have the ability to modify the directory!!</p> <p>Now grant the user created By: </p> <pre><code> "CREATE Login UName WITH PASSWORD = 'UPassword', DEFAULT_DATABASE=[MyDatabase], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF; " &amp; _ "exec sp_addsrvrolemember N'UName', sysadmin; " </code></pre> <p>Now add that user to all the roles you wish, example: </p> <pre><code>"USE [MyDatabase] " "EXEC sp_addrolemember N'db_datareader', N'User' " </code></pre> <p>There are other actions which you may choose to take on the user. But this depends on what your trying to accomplish.</p> <p>The last step is to connect your application using this new account by:</p> <p>Connection string: </p> <pre><code>Data Source=***********\SQLEXPRESS;AttachDbFilename=****\Datafile.mdf;Initial Catalog=MyDatabase;Persist Security Info=True;User ID=UNAME;Password=UPassword" /&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload