2
Answers

how to store gridview datas to sql database

ramya t

ramya t

8y
275
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
This is my web form.In this form i have retrieved data's from two tables which is the supplierid and supplier company name datas are retrieved from Supplier table.Product id,product name,product price datas are retrieved from Product Table.Now i can connect Both tables in single form(above form).
 
i have select one supplier ,what product product the supplier to be supplied which is selected from listbox1 to listbox2.all the details should be loaded in to gridview by clicking load button like wise the gridview datas are stored in to another table 'SuppvsPro'.
Again I have select the same Supplier with prevoius product as well as some new products ,the datas are loaded in to gridview.but the table contains previous products as well as new loaded products,My expectation is the table contains only new datas with our duplication.
 
Please help me how can i solve this problem.
 
 
 Actual database value
Supplier id   SupplierCompany   Productid   ProductName   ProductPrice
Supp1            Pachaas                  app001      Apple                  80
Supp1              Pachaas                Cin001      Cinthol                 33
 
 The Supp1 supplied only these two products ,again I have add some product with thease products
 The database will be,
 
Supplier id    SupplierCompany    Productid     ProductName    ProductPrice
Supp1                Pachaas                app001          Apple                80
Supp1                 Pachaas                Cin001        Cinthol                33
Supp1                 Pachaas                 app001        Apple                80
Supp1                   Pachaas                Cin001        Cinthol                33
Supp1                  Pachaas                 Ham002        Hamam            31
 
My Expectation result is,
 
Supp1 Pachaas  app001   Apple   80
Supp1 Pachaas Cin001   Cinthol    33
Supp1 Pachaas Ham002  Hamam  31
 
without duplication.Please help me.Thank You
Answers (2)