Tuesday, March 20, 2012

Cannot Open Database after Publishing

Hi All,

I have developed a database application using c# and SQL Express 2005.

I have coded a connection string that works fine on the development machine but upon publishing to another machine I am getting the following error message:

Cannot open database "name of database" requested by the login. The login failed. Login Failed for user "machine name\user name".

The remote machine has SQL server express installed.

Now on the development machine the machine name and user names are different to that on the remote machine. I am using Windows Auth. The application successfully runs on the remote machine. It even updates the same database (as mentioned in the issue above) on a different form which all connection strings etc were created automatically by c#. I'm pretty new to all this and don't know where to go from here.
Any help would be greatly appritiated.

Thanks
Jon.

Hi,

The error message says that you have Windows Authentication , change it to SQL/Mix Authentication and your application will run.

Refer below links

http://support.microsoft.com/kb/555332

http://hemantgirisgoswami.blogspot.com/2006/11/change-authentication-mode-with.html

And also refer How to enable Remote Connection

blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx

http://support.microsoft.com/kb/914277/en-us

Hemantgiri S. Goswami

|||Thanks. I will give that a try.|||Hi Hemantgiri,

Thanks for the reply. Do I need to change this in SQL Man Studio Express or in my application?

Sorry, I'm new to this

Thanks

Jon|||

Hi,

You need to change this in your SQL Server Properties using SQL Server Management Studio.

1. Open Your SQL Server Management Studio

2. Connect / Login to Server

3. Right Click on the Server Name

4. Click on Properties

5. Select Security

6. Select the option "SQL Server and Windows Authentication Mode" under Server Authentication

7. Click Ok

Hemantgiri S. Goswami

|||Thanks

No comments:

Post a Comment