1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

data grid with mssql using stored procedure

Discussion in 'C#' started by kianmiranda, Sep 6, 2010.

  1. kianmiranda

    kianmiranda New Member

    Joined:
    Sep 6, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    hi
    please i need help with the query using the values from the combo box and the result will show on the data grid

    sp

    Code:
     ALTER procedure [dbo].[sp_GetReservistInfo_ByDesignation]
    @Platoon varchar (50),
    @Company varchar (50),
    @Batallion varchar (50),
    @Brigade varchar (50),
    @Division varchar (50),
    @FirstName varchar(50), 
    @MiddleName varchar(50), 
    @LastName varchar(50),
    @AFPSN varchar(50)
    
    as
    
        begin
                    SELECT   
                            ReservistInfoDesignation.Squad, 
                            ReservistInfoDesignation.Element, 
                            ReservistInfoDesignation.Rank, 
                            ReservistInfo.AFPSN, 
                            ReservistInfo.LastName, 
                            ReservistInfo.MiddleName, 
                            ReservistInfo.FirstName
                    FROM         
                            ReservistInfo,
                            ReservistInfoDesignation 
            
                    WHERE
                            Division = @Division
                            or Brigade = @Brigade 
                            or Batallion = @Batallion
                            or Company = @Company
                            or Platoon = @Platoon
        endand on the class
    
     public DataTable GetReservistsDesignation()
            {
                try
                {
                    sqlHelper.CreateConnection();
                    sqlHelper.CreateCommand("sp_GetReservistInfo_ByDesignation");
                    
                    sqlHelper.ExecuteDataTable();
                    sqlDT = sqlHelper.DataTable;
                }
                catch (Exception ex)
                {
    
                }
                finally
                {
                    sqlHelper.CloseConnection();
                }
                return sqlDT;
            }
     

Share This Page