Hi Anu,
Check this link, probably this is what you want. You will need to get datatable from your gridview and then just call the below method:
private static bool StoreInDataBase(DataTable dtDetails, string connectionString, string tableName)
{
if (dtDetails != null && dtDetails.Rows.Count > 0)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
using (SqlBulkCopy bulkcopy = new SqlBulkCopy(connection))
{
bulkcopy.DestinationTableName = tableName;
try
{
bulkcopy.WriteToServer(dtDetails);
}
catch (Exception ex)
{
return false;
}
}
connection.Close();
}
}
return true;
}
Check this link,
Store complete data table in database