I want to insert multiple row from database to gridview ,below is my data,in which i want to search PackMaster ID along with PackDetail ,data will be fatched from DB and insert into gridview ,
First i will insert data of Pack Master 1111 ID then will insert 1112 into gridview along with Pack detail where both ID exit .
CREATE TABLE #ItemMasterFile(CodeItem INT,Descriptionitem VARCHAR(50),SecID INT,weight int);
CREATE TABLE #Probale(BID INT,CodeItem INT,prdQTY INT,Orderno int,weight int,Entrydate DATETIME,DelID int);
CREATE TABLE #PackMaster(OID INT,Entrydate DATETIME);
CREATE TABLE #PackDetail(DID INT,ODI INt,BID INT,CodeItem INT,QTY int);
INSERT INTO #ItemMasterFile VALUES
(1,'A',1,100)
, (2,'B',2,100)
, (3,'C',3,100)
, (4,'D',4,100)
, (5,'e',5,100)
, (6,'f',6,100)
, (7,'g',4,100)
, (8,'h',4,100)
, (9,'K',2,100)
, (10,'L',4,100)
, (11,'M',2,100);
INSERT INTO #Probale VALUES
(1001,1,1,001,100,'01-05-2019',null),
(1002,1,1,001,100,'01-06-2019',null),
(1003,3,1,001,200,'02-07-2019',null),
(1004,11,1,002,200,'03-08-2019',null),
(1005,10,1,002,200,'08-08-2019',null),
(1006,1,1,003,200,'08-08-2019',null),
(1007,1,1,003,200,'08-08-2019',null);
Insert into #PackMaster values
(1111,'01-05-2019'),
(1112,'01-05-2019');
Insert into #PackDetail values
(1,1111,1001,1,1),
(2,1111,1002,1,1),
(3,1111,1003,3,1),
(4,1111,1004,11,1),
(5,1112,1005,10,1),
(6,1112,1006,1,1),
(7,1112,1007,1,1),
(8,1112,1008,11,1);