Akhter HUssain

Akhter HUssain

  • 720
  • 1.3k
  • 102.1k

How to add new bulk rows into gridview from DB in asp.net C#

Nov 26 2019 1:10 AM

i want to insert rows from DB to gridview ,

I have two table PackMaster and PackDetail ,PackMaster table id is link with PackDetail table ,below is my data,

i will Add first ID 1111 with all Child table record(Pack Detail table) and then i will Add1112 ID record into gridview,

  1. CREATE TABLE #ItemMasterFile(CodeItem INT,Descriptionitem VARCHAR(50),SecID INT,weight int);  
  2. CREATE TABLE #Probale(BID INT,CodeItem INT,prdQTY INT,Orderno int,weight int,Entrydate DATETIME,DelID int);  
  3.   
  4. CREATE TABLE #PackMaster(OID INT,Entrydate DATETIME);  
  5. CREATE TABLE #PackDetail(DID INT,ODI INt,BID INT,CodeItem INT,QTY int);  
  6.      
  7. INSERT INTO #ItemMasterFile VALUES  
  8.   (1,'A',1,100)  
  9. , (2,'B',2,100)  
  10. , (3,'C',3,100)  
  11. , (4,'D',4,100)  
  12. , (5,'e',5,100)  
  13. , (6,'f',6,100)  
  14. , (7,'g',4,100)  
  15. , (8,'h',4,100)  
  16. , (9,'K',2,100)  
  17. , (10,'L',4,100)  
  18. , (11,'M',2,100);  
  19.    
  20.  INSERT INTO #Probale VALUES  
  21. (1001,1,1,001,100,'01-05-2019',null),  
  22. (1002,1,1,001,100,'01-06-2019',null),  
  23. (1003,3,1,001,200,'02-07-2019',null),  
  24. (1004,11,1,002,200,'03-08-2019',null),  
  25. (1005,10,1,002,200,'08-08-2019',null),  
  26. (1006,1,1,003,200,'08-08-2019',null),  
  27. (1007,1,1,003,200,'08-08-2019',null);  
  28.   
  29.  Insert into #PackMaster values  
  30.  (1111,'01-05-2019'),  
  31.  (1112,'01-05-2019');  
  32.   
  33.   Insert into #PackDetail values  
  34.  (1,1111,1001,1,1),  
  35.  (2,1111,1002,1,1),  
  36. (3,1111,1003,3,1),  
  37. (4,1111,1004,11,1),  
  38.  (5,1112,1005,10,1),  
  39.  (6,1112,1006,1,1),  
  40. (7,1112,1007,1,1),  
  41. (8,1112,1008,11,1);  

Answers (3)