at first a few things about my system:
I use Visual Studio 2005 Pro on WinXP SP2 and I have recently installed MSSQL Server 2005 Express on my system.
I want to establish a connection to the MSSQL Server from C++ (not .NET) using ADO.
For this I use the following connection String:
Open(L"Provider=SQLNCLI;Server=FREECASTLE;Integrated
Security=SSPI;DataTypeCompatibility=80;MARS
Connection=True;",L"",L"",ADODB::adConnectUnspecified);
This works. But this is not exactly that what I wanted, because here
just my Windows Authentication is used. I want to be able to pass
username and password for users that are allowed to access the SQL
Server. Here my first confusion begins: I have the option to pass the username and password into the connection string (User Id and Password) or I guess that I can pass them also as parameter 2 and parameter 3. But with trying both of these options I get always a connection error that my specified Username is not be trusted ( I don't know how the message looks in the English version, because I have the german version), but I suppose you know what I mean.
Of course I have to create such accounts in the SQL Server before trying to login with them. I guess that I made something wrong when doing this. I started the Server Manager Studio and there I navigated into the Object Explorer. In the folder Security I created a new account for testing (using SQL Server Authentication). But I cannot use that account for logging in.
I have to admit that I am very new to the SQL Server thing, so I hope someone can help me or can give me hints on what to do better. I am very thankful for every reply...That specific error message means, that you only enabled your server for WIndows authentication, if you want to use also SQL Server authentication you will have to enabled it first (using mixed Authentication). See the Screencast on my site for more information about Changing the authentication mode in SQL Server.
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de|||Hi Jens,
with your Screencast I solved my problem. Thank you very much for your help.
No comments:
Post a Comment