1.11M Members

data grid with mssql using stored procedure

 
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

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
    end

and 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;
        }
You
Post:
Start New Discussion
View similar articles that have also been tagged: