Hello everyone

I have a windows form application in Visual Studio 2012, with a datagridview. I need to save new data on this datagridview to a SQL database.

Could anyone help me with the code or a procedure.

The database name is PRISOON, and the table records to be added information are EXPORTWEB and EXPORT.

Here is the existing code:

Public Class StatusEncomendas

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    'TODO: This line of code loads data into the 'PRISOONDataSet.CabecDoc' table. You can move, or remove it, as needed.
    Me.CabecDocTableAdapter.Fill(Me.PRISOONDataSet.CabecDoc)

End Sub

Private Sub CabecDocDataGridView_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles CabecDocDataGridView.CellContentClick

End Sub

Private Sub CabecDocBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
    Me.Validate()
    Me.CabecDocBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.PRISOONDataSet)
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs)
    Me.Update()

End Sub

End Class

Thank you very much

Are you trying to fetch the data directly from datagridview then send it to SQL?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.