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

Frage

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

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top