Imports System.Data.SqlClient
Public Class Form1
    Dim da As SqlDataAdapter
    Dim ds As DataSet

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim strSql As String = "select * from member"
        Dim strConn As String = "Data Source = . ; Initial Catalog = Northwind ; Integrated Security = true"
        Dim conn As New SqlConnection(strConn)

        da = New SqlDataAdapter(strSql, conn)
        Dim cb As New SqlCommandBuilder(da)

        ds = New DataSet

        da.Fill(ds, "member")
        DataGridView1.DataSource = ds.Tables(0)


    End Sub

    Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
        da.Update(ds, "member")
    End Sub
End Class

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 alen1985 的頭像
    alen1985

    1與0的世界

    alen1985 發表在 痞客邦 留言(0) 人氣()