Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

connection to database with name and password

$
0
0

Hello,

I want to allow access to a database from another computer via tcp/ip connection.

When i use Windows authentication, this works if access from the same Windows account name; it is not necessary to supply any UserID or something else. But how to authorize access from another windows user account?

When i don't use  Windows authentication ( SqlConnectionStringBuilder.IntegratedSecurity=false in C#) i never succed to acces to the database even on the pc where the database is. I created a login+password+user using code like

command.CommandText = String.Format( "CREATE LOGIN {0} WITH PASSWORD='{1}';", login, password );
command.ExecuteNonQuery();
command.CommandText = String.Format( "CREATE USER {0} FOR LOGIN {1};", userName, login );
command.ExecuteNonQuery();

but how to use these Login, user, password ?

What i'd like to do is simple: allow access to my DB by supplying a Name and a Password.

Somone can help?

Regards,

PS: I use VS express2014, C#, .net 4.x and VS CE 2013, Windows 8.1&7

Pascal


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>