Imports System.Data.OleDb
Public Class กิจกรรม
Dim cnn As New OleDb.OleDbConnection
Private Sub กิจกรรม_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Table_ As String = "rubbersmall"
Dim query As String = "SELECT * FROM " & Table_
Dim MDBConnString_ As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=datason.accdb;"
Dim ds As New DataSet
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub reset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles reset.Click
Me.txtdetial.Text = ""
Me.txtday.Text = ""
Me.txtcorver.Text = ""
Me.txttree.Text = ""
Me.txtlobor.Text = ""
Me.txtunit.Text = ""
Me.txtjob.Text = ""
Me.txtdays.Text = ""
Me.Id.Text = ""
Me.Id.Focus()
End Sub
Private Sub RefreshData()
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If
Dim da As New OleDb.OleDbDataAdapter("SELECT Id as [Id], " & _
"details as [details],convert,tree,area,unit,lobor,day,days " & _
"FROM datason ORDER BY ID", cnn)
Dim dt As New DataTable
da.Fill(dt)
Me.dgvdata.datasouce = dt
cnn.Close()
End Sub
Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click
Dim cmd As New OleDb.OleDbCommand
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If
cmd.Connection = cnn
cmd.CommandText = "INSERT INTO rubbersmall (ID,details,convert,number tree,unit,labor,number day) " & _
"VULUES (" & Me.Id.Text & ",'" & _
Me.txtdetial.Text & ",'" & Me.txtcorver.Text & ",'" & Me.txttree.Text & ",'" & Me.txtunit.Text & ",'" & Me.txtlobor.Text & ",'" & Me.txtday.Text & ",'" & Me.txtdays.Text & "')"
cmd.ExecuteNonQuery()
RefreshData()
cnn.Close()
End Sub
Private Function dgvdata() As Object
Throw New NotImplementedException
End Function
End Class
Dim Cnn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=datason.accdb;Persist Security Info=False;")
If Cnn.State = ConnectionState.Open Then Cnn.Close()
Cnn.Open()