Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connecting string to SQL Server
Message
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01532080
Message ID:
01532087
Views:
30
>>>>Hi,
>>>>
>>>>When I am testing my ASP.NET to connect to SQL Server I use the following connecting string:
>>>>
>>>>
>>>>connString = "server=MYCOMPUTER\\SQLEXPRESS; database=MyDatabaseName; Trusted_Connection=Yes"
>>>>
>>>>
>>>>But I get an error:
>>>>
>>>>
>>>>Cannot open database "MyDatabaseName" requested by login. The login failed. 
>>>>Login failed for user 'MYCOMPUTER\Dmitry' 
>>>>
>>>>
>>>>I suppose the "Trusted_Connection" syntax is not recognized, right? What should I change in my connString?
>>>
>>>You could try swapping it for 'Integrated Security=True' - but the simplest way to get it right might be to just let the IDE create the string via ServerExplorer ?
>>
>>I don't know, yet, how to use ServerExplorer. I am just trying to create a "Hello World" of the SQL Server connection (if you know what I mean). Changing Trusted_Connection to Integrated Security didn't solve the problem. I suppose next I need to create a log in (learn how) in the SQL Server and enter the 'uid' and 'pwd' in the connection string.
>
>In VS:
>Select View/ServerExplorer from the menu.
>Right click 'DataConnections' in the Server Explorer Window and choose 'Add Connection'.
>Choose Server Name, Authentication etc in the pop-up window.
>Use 'Test Connection' to verify that it works.
>With the connection added to the ServerExplorer window right click on it and choose 'Properties'. The string you need is shown in the properties window....
>
>HTH

This is very helpful. I learned that my test database is the problem. I keps getting the error 'Login failed for user 'MYCOMPUTER\Dmitry' when using my test database. So I suppose my the user Dmitry does not have access rights to this database. When I changed the database name to another, the error was gone. I will have to learn how to assign my test database (or any database) to be accessable with Integrated Security. If you have any suggestions, please let me know.

Thank you very much for your help!
"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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform