使用dataviewgrid更改提供的信息更新我的SQL Server,主要是复选框/位字段。
如果我只使用一个表,我可以填充我的dataviewgrid,甚至可以更新它,问题是我希望我的查询具有三个表,以便显示信息。
我试图复制一些教程并自行更改,但似乎没有点击。
自从我用VB编码以来已经有一段时间了,所以还有。
到目前为止我所拥有的:
Imports System.Data.SqlClient
Public Class Form1
Dim myDA1 As SqlDataAdapter
Dim myDataSet1 As DataSet
Dim myDA2 As SqlDataAdapter
Dim myDataSet2 As DataSet
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con2 As SqlConnection = New SqlConnection("Data Source=CONNECTION STRING WORKS FINE")
Dim cmd2 As SqlCommand = New SqlCommand("SELECT x1,y2,z1 from a inner join b where a.x1=b.x2", con2)
con2.Open()
myDA2 = New SqlDataAdapter(cmd2)
Dim builder2 As SqlCommandBuilder = New SqlCommandBuilder(myDA2)
myDataSet2 = New DataSet()
myDA2.Fill(myDataSet2, "MyTable2")
DataGridView2.DataSource = myDataSet2.Tables("MyTable2").DefaultView
con2.Close()
con2 = Nothing
End Sub
Private Sub DataGridView2_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView2.CellContentClick
Me.Validate()
Me.myDA2.Update(Me.myDataSet2.Tables("MyTable2"))
Me.myDataSet2.AcceptChanges()
End Sub
End Class
它是在基本查询上更新的,是的,但是我需要使其在联接查询上更新。
答案 0 :(得分:1)
正如我在评论中所说,使用联接时不能使用(function ($, Drupal, drupalSettings) {
'use strict';
Drupal.behaviors.sc_custom_header = {
/**
* Drupal attach behavior.
*/
attach: function(context, settings) {
//Header video code for Home
var video = $('<video />', {
id: 'video-header',
playsinline:"playsinline",
autoplay:"autoplay",
muted:"muted",
loop:"loop",
});
var mp4_src = $('#mp4').get(0).getAttribute('data-src');
var webm_src = $('#webm').get(0).getAttribute('data-src');
var ogg_src = $('#ogg').get(0).getAttribute('data-src');
$('#mp4').attr('src', mp4_src);
$('#webm').attr('src', mp4_src);
$('#ogg').attr('src', mp4_src);
}
};
})(jQuery, Drupal, window.drupalSettings);
。您需要为DataAdapter提供自己的Update,Insert和Delete命令。确保使用包含源列名称的Parameters.Add方法的重载。这提供了DataAdapter的映射。我在机器上使用数据库来显示代码。您可能要添加用于插入和删除的命令。
CommandBuilder