#if NET_2_0
override
#endif // NET_2_0
- void ChangeDatabase (string database)
+ void ChangeDatabase (string database)
{
if (!IsValidDatabaseName (database))
throw new ArgumentException (String.Format ("The database name {0} is not valid.", database));
private void ChangeState (ConnectionState currentState)
{
+ if (currentState == state)
+ return;
+
ConnectionState originalState = state;
state = currentState;
OnStateChange (CreateStateChangeEvent (originalState, currentState));
#if NET_2_0
override
#endif // NET_2_0
- void Close ()
+ void Close ()
{
if (transaction != null && transaction.IsOpen)
transaction.Rollback ();
ChangeState (ConnectionState.Closed);
}
- public new SqlCommand CreateCommand ()
+ public new SqlCommand CreateCommand ()
{
SqlCommand command = new SqlCommand ();
command.Connection = this;
ChangeState (ConnectionState.Open);
}
- private bool ParseDataSource (string theDataSource, out int thePort, out string theServerName)
+ private bool ParseDataSource (string theDataSource, out int thePort, out string theServerName)
{
theServerName = string.Empty;
string theInstanceName = string.Empty;
}
#endif
- private sealed class SqlMonitorSocket : UdpClient
+ private sealed class SqlMonitorSocket : UdpClient
{
// UDP port that the SQL Monitor listens
private static readonly int SqlMonitorUdpPort = 1434;
instance = InstanceName;
}
- internal int DiscoverTcpPort (int timeoutSeconds)
+ internal int DiscoverTcpPort (int timeoutSeconds)
{
int SqlServerTcpPort;
Client.Blocking = false;
}
#if NET_2_0
- struct ColumnInfo {
+ struct ColumnInfo
+ {
public string name;
public Type type;
+
public ColumnInfo (string name, Type type)
{
this.name = name; this.type = type;