我们想在数据库中保存datagridview的标头。 datagridview的标题是我们在文本框中输入的值。我们想要的是将标题保存为数据库的字段。有谁知道怎么做??谢谢
答案 0 :(得分:0)
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim fetchDGVHeaders(DataGridView1.ColumnCount) As String
For a = 0 To DataGridView1.ColumnCount - 1
fetchDGVHeaders(a) = DataGridView1.Columns(a).Name
MsgBox(fetchDGVHeaders(a))
Next
INSERT_INTO_DB("INSERT INTO DBHeaders(MEaw,MEow,MEow_MEow)VALUES('" & fetchDGVHeaders(0) & "','" & fetchDGVHeaders(1) & "','" & fetchDGVHeaders(2) & "','" & fetchDGVHeaders(3) & "')")
End Sub
获取当前的DataGridView标头,然后将其存储到其他表