C#, In a Mysql connection proprety connection.Server and connection.DataSource are always equals or there is a case where are different?

StackOverflow https://stackoverflow.com/questions/22440638

In my program I can see these proprietes are always equals, can be different in some exceptional case?

有帮助吗?

解决方案

If you connect to a different server, the values will be different, but I bet you already knew that. Furthermore the documentation of the DataSource property mentions that the state of the connection (open or closed) can affect its value. I don't know about the Server property.

If you are looking for a way to identify "equal" connections, you may want to use the ConnectionString property. This is how Connection Pooling determines whether a closed connection can be reused.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top