Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to connet to SQL Server newbie?
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00940862
Message ID:
00940996
Vues:
10
Thank you so much for a detailed answer. I don't remember how I set up the SQL Server (mixed mode or another) when I installed it, it has been some time ago. I will have to look for something in the Enterprise Manager to figure out that. I am not prompted to enter a user name and password when getting to the database in Enterprise Manager so I don't even know if such thing was set up.

>Although the syntax that you used should work if you are logged in as an administrator on your machine (and the database name is correct (database name is not case-sensitive)), you might try the more common syntax of:
>
>
>cn.ConnectionString = "server=(local);database=Northwind;Integrated Security=SSPI;";
>
>
>More commonly, however, systems are written using SQL Server authentication rather than Windows Authentication (provided, of course, that you set SQL Server up in mixed mode so that you can use either type of authentication).
>
>In that case, the syntax is:
>
>cn.ConnectionString = "Data Source=localhost;" +
>           "Initial Catalog=Northwind;user id=userid;password=password";
>
>
>First, note that the above user id is a SQL Server user id, not a Windows user id (Set that up in Enterprise Manager in the Security folder.)
>
>Secondly, note that there are several equivalent ways of designating a connection string. "localhost" is equivalent to "(local)" (in most installations, that is), "Initial Catalog" is equivalent to "database". The syntax in the second example, however, is the most common and, I believe, the preferred syntax for connecting to SQL Server. (I hope I'm not starting a holy war here!)
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform