Example #1
0
    private void BindPlayers()
    {
        int        clubId  = (int)Session["ClubDetailsId"];
        SqlCommand command = new SqlCommand();

        command.CommandText = "SelectPlayers";
        command.CommandType = CommandType.StoredProcedure;
        command.Parameters.Add("RegID", SqlDbType.Int);
        command.Parameters["RegID"].Value = clubId;
        DataConnection myConnection = new DataConnection();

        try
        {
            PlayerList.DataSource   = myConnection.ExecuteCommand(command);
            PlayerList.DataKeyNames = new string[] { "PlayerName" };
            PlayerList.DataBind();
        }
        finally
        {
            myConnection.CloseConection();
        }
    }
    private void BindDetails()
    {
        String     PlayerName = (String)Session["PlayerDetailsName"];
        SqlCommand command    = new SqlCommand();

        command.CommandText = "SelectPlayerDetails";
        command.CommandType = CommandType.StoredProcedure;
        command.Parameters.Add("Name", SqlDbType.NVarChar);
        command.Parameters["Name"].Value = PlayerName;
        DataConnection myConnection = new DataConnection();

        try
        {
            DetailsView.DataSource   = myConnection.ExecuteCommand(command);
            DetailsView.DataKeyNames = new string[] { "PlayerName" };
            DetailsView.DataBind();
        }
        finally
        {
            myConnection.CloseConection();
        }
    }