Dear aehb,
I'm sure that the solutions you've got so far must not have solved your problem coz they don't address the REAL issue you have.
Well, let's discuss connection strings first. We'll be discussing then the REAL problem.
If you're using a Windows account to login to SQL Server, your connection string should look like this:
Provider=SQLOLEDB;Data Source=<data_source_name>;
Initial Catalog=<database_name>;Integrated Security=SSPI
If you're using a SQL Server account to login to SQL Server, however, your connection string should resemble this one:
Provider=SQLOLEDB;Data Source=<data_source_name>;
Initial Catalog=<database_name>;uid=<user_id>;pwd=<passwor d>
Note: When using a SqlConnection object to connect to your database, plz remove
Provider=SQLOLEDB; from your connection string.
Now let's discuss the REAL problem. Well, SQL Server can use two modes of security:
Windows Authentication and
Windows and SQL Server Authentication. In Windows Authentication only those users can login to SQL server who have a Windows account. Other users, including those having a valid
SQL Server account, will simply be [b]not[b] allowed to login. In Windows and SQL Server Authentication, on the other hand, both types of users, those who have a Windows account and those who have a SQL Server account, can login to SQL server.
You might have guessed that the problem you're having is that your SQL server is configured to use Windows Authentication and you're trying to login to it using a SQL Server account! In order to be able to use either a Windows account or a SQL Server account to successfully login to your SQL server, you must configure it to use Windows and SQL Server Authentication. To do so, follow these steps:
- Open SQL Server Enterprise Manager
- Expand the nodes to show your SQL Server node
- Right-click the SQL Server node and select Properties
- On the Properties dialog box, click the Security tab
- On the Security tab, under Authentication, select the SQL Server and Windows option button
- Click the OK button
- You'll be prompted to stop and restart the SQL Server service. Give a +ve response and wait until the service is restarted
Now your server will have been configured to use Windows and SQL Server Authentication mode and, so, you'll be able to login to it using either Windows or SQL Server account.
Hope you get your solution!
ejan