SQL Server 2008 R2 connection string error [duplicate] - c#

This question already has answers here:
ExecuteReader requires an open and available Connection. The connection's current state is closed
(3 answers)
Closed 8 years ago.
I have a SQL Server 2008 R2 running but when I try to connect to the server via my C# connection string I receive an error. I have no clue of what the problem is!
Here is my connection string:
_msConnection = new SqlConnection("Server=ServerIpAdress;Database=DataBaseName;User Id=NetworkName\\UserName;Password=PW;");
I hope some of you guys can help me?
Have a great day you all!

Id=NetworkName\\UserName
sounds a bit strange, try
Id=username
Also if you can connect to the DB using MS VS, MS SMS or any other likely tools your app can connect passin exactly same paramenters.
Other things to check: Actual user running the app (IIS_USR maybe)
In your SMS or VS you can get the actual connection string being used and just copy past it.

Related

Unrecognized database format In MS Access due to multiple locks functioning on the database file at the same time [duplicate]

This question already has answers here:
Recent rash of Microsoft Access database files in an inconsistent state
(2 answers)
Closed 2 years ago.
Hello EveryoneI have created a c# application with MS-Access database. But when I run it on network where multiple clients access the database at same time, following error occurred some times.Unrecognized database format I researched this topic a lot and found that this issue is happening due to multiple locks functioning on the database file at the same time.How can I overcome this. Please suggest.
Edit: When I try to open the database it shows some type of corruption and displays the following message Microsoft Access has detected that this database is in an inconsistent state, and will attempt to recover the database
Most likely you have been hit by the well-known lease bug being around for years. A good summarise can be found at Daniel's blog:
Access – Bug – Database is in an Unrecognized Format
The current status is, unfortunately, quo.

Invalid connection string [duplicate]

This question already has an answer here:
SQL Server connection string
(1 answer)
Closed 6 years ago.
Apparently this connection string is incorrect?
connectionString="Server=mydb.com:1433/sqlExpress;Database=d;User Id=d;Password=pw;"
the first think that I see is that you have type wrong this part
Server=mydb.com:1433
use
Server=mydb.com,1433
the sql server use the comma to separate the port.
Also take a look at that answer: Setting up connection string in ASP.NET to SQL SERVER

Can connect to mySql server via php but not with c# [duplicate]

This question already has answers here:
How to form a correct MySQL connection string? [closed]
(3 answers)
Closed 8 years ago.
As I wrote in the topic, this works totally fine:
mysql_connect("server","username","password");
But this doesn't:
MySql.Data.MySqlClient.MySqlConnection connection =
new MySql.Data.MySqlClient.MySqlConnection("SERVER=server;DATABASE=database;UID=username;PASSWORD=password;");
connection.Open();
The exception is always
Unable to connect to any of the specified MySQL hosts
And no, the question is neither a duplicate, nor answered there
As per the documentation, this
"SERVER=server;DATABASE=database;UID=username;PASSWORD=password;"
should be
"SERVER=server;DATABASE=database;UID=username;PWD=password;"

Executing commands by using Telnet in C# [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
C# Telnet Library
I wish to do telnet programatically using C# so that once I establish the connection to the server, I can execute the commands like ls, ls -l, mv, rm.. etc on the server.
Is it possible? Are there classes in C# for this purpose similar to the classes for FTP (FtpWebRequest)? If yes, please direct me to the right approach.
When I execute ls, I need the list generated on server to be sent to the client i.e. windows machine in my case.
Yes, here you have a telnet library
http://www.codeproject.com/KB/IP/MinimalisticTelnet.aspx

can't create SQL DataBase using Server Explorer in Visual Studio 2010 [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
create table permission denied in database ‘master’
I'm trying to create an SQL database by using Server Explorer in Visual Studio 2010.
Server Explorer >> Data Connection >> Create new Sql Server Database
But when I'm trying to create the database it gives the error message
CREATE DATABASE permission denied in database 'master'
I think it's about access privileges. I've searched quite a bit but can't find a solution.
Yup You've guessed it right it is a problem relating to your credentials being used to create the database (which in fact does not have access in your case )
Dariusz Parys have given a nice Fix to your problem here

Categories