นี่โค้ดครับ ลืมบอกไปครับ ของผมใช้ โปรแกรม Microsoft Visual Basic 2008 Express Edition
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'DatabaseFwDataSet.Product' table. You can move, or remove it, as needed.
Me.ProductTableAdapter.Fill(Me.DatabaseFwDataSet.Product) ตรงนี้อ่ะครับ
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ProductBindingSource.AddNew()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ProductBindingSource.EndEdit()
ProductTableAdapter.Update(DatabaseFwDataSet.Product)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
ProductBindingSource.RemoveCurrent()
ProductBindingSource.EndEdit()
ProductTableAdapter.Update(DatabaseFwDataSet.Product)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox6.Text = Val(TextBox3.Text) + Val(TextBox4.Text) - Val(TextBox5.Text)
End Sub
End Class
ผม Run Program Vbแล้วมันขึ้น The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. แก้ยังไครับ
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'DatabaseFwDataSet.Product' table. You can move, or remove it, as needed.
Me.ProductTableAdapter.Fill(Me.DatabaseFwDataSet.Product) ตรงนี้อ่ะครับ
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ProductBindingSource.AddNew()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ProductBindingSource.EndEdit()
ProductTableAdapter.Update(DatabaseFwDataSet.Product)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
ProductBindingSource.RemoveCurrent()
ProductBindingSource.EndEdit()
ProductTableAdapter.Update(DatabaseFwDataSet.Product)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox6.Text = Val(TextBox3.Text) + Val(TextBox4.Text) - Val(TextBox5.Text)
End Sub
End Class