Invalid connection string [duplicate] - c#

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

Related

Detecting and replacing all smilies in a string [duplicate]

This question already has answers here:
Mysql server does not support 4-byte encoded utf8 characters
(8 answers)
Closed 7 years ago.
I have a integration with facebook and have notice that thay sends for example u+1f600 that is called a grinning face. When I try to store this in the MySQL Text field I get Server does not support 4-byte encoded so a fast solution is to remove all these special chars from the string.
The question is how? I know about the u+1f600 but I suspect that there could be more of them.
Consider switching to MySQL utf8mb4 encoding... https://mathiasbynens.be/notes/mysql-utf8mb4

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;"

SQL Server 2008 R2 connection string error [duplicate]

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.

How to prevent oracle from converting empty strings to null [duplicate]

This question already has answers here:
Why does Oracle 9i treat an empty string as NULL?
(10 answers)
Closed 9 years ago.
I have successfully converted an existing app's database from SqlServer to Oracle.
Everything works fine, but empty strings.
The app normally stores empty strings into the not null nvarchar2 fields which Oracle silently converts them to null and causes the following error:
ORA-01400: cannot insert NULL
Is there any workaround for this?
Note: I'm using Oracle Managed Driver ODP.NET + NHibernate Castle Active Record
you can use nvl(column_name,'')
Good Luck

Connection pooling in Entity Framework 1 [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Entity Framework and Connection Pooling
Does EF1 support Connection Pooling? If yes, what we need to do to manage it?
I don't think you need to do anything except to make sure your connection string throughout the application stays the same. .NET will take care of the rest herself.
Connection pooling is supported by EF and it is default. If you want to change it you can alter Pooling parameter in the connection string true or false.
Assuming SQL Server, somewhere underneath the EF code, a SqlConnection is created using a connection string. A pool of connections will be created per connection string.
It should simply work, without any code / config on your side

Categories