做成事件把
    public void PreCommand(SqlConnection sqlConnection, string strCommand, params SqlParameter[] param) 
    { 
        sqlCommand.CommandText = strCommand; 
        sqlCommand.Connection = sqlConnection;         AddParms(param);         if (sqlConnection.State == ConnectionState.Closed) 
try
{
            sqlConnection.Open(); 
}
catch(SqlException e)
{
   if(ConnError!=null)ConnError(e):
}    }         public delegate void OpenError(SqlException e);
        public event OpenError ConnError;