views:

25

answers:

0

The following is the code.

I have written every posssible handler for server object I can think of, but still the horrible page appears.

  • when i give the name of the SERVER INCORRECTLY in textbox1 which is used further.

    protected void Page_Load(object sender, EventArgs e)

     if (TextBox1.Text.Length>0)
    
    
    {
        Server srv;
    
    
       ServerConnection conContext = new ServerConnection();
    
    
       conContext.ServerInstance = TextBox1.Text;
    
    
       conContext.LoginSecure = false;
    
    
       conContext.Login = "will not tell :-)";
    
    
       conContext.Password = "sorry :-)";
    
    
       srv = new Server(conContext);
    
    
       srv.ConnectionContext.RemoteLoginFailed += new ServerMessageEventHandler(ConnectionContext_RemoteLoginFailed);
    
    
       srv.ConnectionContext.InfoMessage += new System.Data.SqlClient.SqlInfoMessageEventHandler(ConnectionContext_InfoMessage);
    
    
       srv.ConnectionContext.ServerMessage += new ServerMessageEventHandler(ConnectionContext_ServerMessage);
    
    
       srv.Events.ServerEvent += new ServerEventHandler(Events_ServerEvent);
    
    
     Response.Write(srv.Information.Version);
    
    
    }
    
    
    //The connection is automatically disconnected when the Server variable goes out of scope.
    

    void Events_ServerEvent(object sender, ServerEventArgs e)

    {

    Label1.Text = sender.ToString() + "
    events server " + e.EventType.ToString();

    //throw new NotImplementedException();
    

    }

ans the remaining event methods have the same code....