I have a big question about ... How do I make multiple entries into my database the records that are inside my datagridview and also outside it?
for example: A trip of such date that would be a data of the datetimepicker, the name that has the trip that would be a textbox and insert all the people that will go to that trip, in this case they would be all those that are in my datagridview .
Using cn As New SqlConnection(My.Settings.conxion)
Using cm As New SqlCommand()
cm.Connection = cn
cn.Open()
For Each dr As DataGridViewRow In dgv_retiro.Rows
cm.CommandText = " INSERT INTO retiros (cod_persona, fec_retiro,nom_evento) VALUES (" & dr.Cells("codigo").Value & "," & Retiros.DateTimePicker1.Value.ToShortDateString & "," & Retiros.txt_evento.Text & ")"
cm.ExecuteNonQuery()
Next
cn.Close()
End Using
End Using
What happens is that he throws me the following error
Excepción no controlada del tipo 'System.Data.SqlClient.SqlException' en System.Data.dll
Additional information: The column name 'Testname' is not valid.
Since thank you very much !!!.