请帮我...
我在数据网格视图中加载我的数据库并编辑一些单元格。现在我只需要更新我的数据库
这是我的代码
Dim dT As DataTable = MyDB.ExecCommand("SELECT `Field Name` FROM `tblfield`", "wellsfargo").Tables(0)
Dim sSQL As String = ""
Dim dZ As DataTable = MyDB.ExecCommand("SELECT " & sColumn & " FROM `" + cboJob.Text.Trim + "`", "wellsfargo", 0).Tables(0)
dColumn = New DataTable
dColumn = MyDB.ExecCommand("SHOW COLUMNS IN tblrecord", "wellsfargo", 0).Tables(0)
If dZ.Rows.Count <> 0 Then
sSQL = "UPDATE " & sColumn & " FROM `" + cboJob.Text.Trim + "`"
MyDB.ExecQuery(sSQL, "wellsfargo")
Else
Dim sColumn As String = ""
For z As Integer = 0 To dT.Rows.Count - 1
If z = 0 Then
sColumn = "`" & dT.Rows(z).Item(0).ToString & "`"
Else
sColumn = sColumn & ",`" & dT.Rows(z).Item(0).ToString & "`"
End If
Next
sSQL = "INSERT INTO `" + MyJob + "` (" + sColumn + ") "
MyDB.ExecQuery(sSQL, "wellsfargo")
End If