I have a table structured below called time
| name | 1 | 2 | 3 | 4 |
and a datagridview structured below
| name | value |
| sani | 1 |
| sani | 2 |
| sani | 3 |
| sani | 4 |
expected outcome
| name | 1 | 2 | 3 | 4 |
| sani | 1 | 2 | 3 | 4 |
i want an SQL command that save the data into MySQl table using DataGridview as the specifying column
when ever am saving it should loop through the DatGridView and save base on specifying column. i can save the data from DataGridview to Database. Let say what am saving is SANI with 3, then it should check for column 3 and save the data.
Thank you in ADVANCE
Muhammad Imran AnsariPosted Jan 20, 2022, 3:15 PM
You can use the SQL bulk query to insert all data at once or through loop on datagrid. Use following reference links:
c# - Insert all data of a datagridview to database at once - Stack Overflow[^]
Bulk Insert:
Bulk Insert In SQL Server From C#[^]