System.Data.SqlClient をインポートします
Public Class Form1 Dim cn As SqlConnection Dim ds As DataSet Dim adapter As SqlDataAdapter Dim eleveBindingSource As BindingSource Dim builder As SqlCommandBuilder
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cn = New SqlConnection("Data source=.; initial catalog=tp4_ado; integrated security=sspi")
ds = New DataSet()
eleveBindingSource = New BindingSource
adapter = New SqlDataAdapter("Select * from Eleve", cn)
adapter.Fill(ds, "Eleve")
eleveBindingSource.DataSource = ds
eleveBindingSource.DataMember = "Eleve"
DataGridView1.DataSource = eleveBindingSource
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
adapter.Update(ds.Tables("Eleve"))
End Sub
クラス終了