Bind the gridview again after adding the record
rkrishnach
Posts
-
Refresh the page after data filled. -
Bulk Insert into database from datatable or dataset or datagridAdd all rows to the datatable. Then use sqlbulkcopy.It inserts all the records into database table in one shot. SqlConnection destinationConnection = new SqlConnection(strConnection); destinationConnection.Open(); SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection ); bulkCopy.DestinationTableName = "destination"; bulkCopy.WriteToServer(yourDatatable); destinationConnection .Close();
-
Insert Multiple Records by one clickBuild datatable in code behind.Add all rows to the datatable. Then use sqlbulkcopy.It inserts all the records into database table in one shot. SqlConnection destinationConnection = new SqlConnection(strConnection); destinationConnection.Open(); SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection ); bulkCopy.DestinationTableName = "destination"; bulkCopy.WriteToServer(yourDatatable); destinationConnection .Close();