I have a condition that i have to insert grid view data into sql table. gridview have multiple row.
on click button i have to submit records at a time in table using c#.
SN.
| Team | Agent | Amount withdraw | Done | Cancel | |
|---|---|---|---|---|---|
| 1 | ABC | Manish | 6416 | 10 | 0 |
| 2 | Luv | Anand | 23401 | 6 | 0 |
| 3 | ABC | Azaz | 21200 | 7 | 0 |
| 4 | ABC | Sunil | 19200 | 5 | 0 |
| 5 | Luv | Jyoti | 14600 | 6 | 0 |
| 6 | Luv | Neeraj | 14451 | 10 | 0 |
| 7 | VIRA | Priyanka | 13100 | 7 | 0 |


RakeshRank #397 · 6.3K reputationPosted Feb 12, 2017, 3:13 AM EST
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Feb 12, 2017, 8:14 AM EST
Ayappan AlagesanRank #4,305 · 352 reputationPosted Feb 12, 2017, 7:13 PM EST
CREATE TYPE [dbo].[MyTableType] AS TABLE( [Id] int NOT NULL, [Name] [nvarchar](128) NULL )CREATE PROCEDURE [dbo].[InsertTable] @myTableType MyTableType readonly AS BEGIN insert into [dbo].Records select * from @myTableType ENDand send your
DataTabledirectly to sql server:using (var command = new SqlCommand("InsertTable") {CommandType = CommandType.StoredProcedure}) { var dt = new DataTable(); //create your own data table command.Parameters.Add(new SqlParameter("@myTableType", dt)); SqlHelper.Exec(command); }