Imports System.Data.OleDb
Public Class updateharvesting
Dim co As OleDbConnection
Dim cm As OleDbCommand
Dim dr As OleDbDataReader
Private Sub updateharvesting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GroupBox1.Visible = False

End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
Label2.Text = "enter no"
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 cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cancel.Click
Me.Close()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
co = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\varsha2011\plotdetails\plotdetails\harvesting.mdb;")
co.Open()
cm = New OleDbCommand()
Dim str As String = " "
Dim table As String = ""
If RadioButton1.Checked = True Then
str = "select * from harvesting where fileno = " & " " & (txtse.Text) & " "

End If


cm.Connection = co
cm.CommandText = str
cm.CommandType = CommandType.Text
dr = cm.ExecuteReader()
If (dr.Read) Then
GroupBox1.Visible = True
txtfile.Text = dr("fileno").ToString()
DateTimePicker1.Value = dr("date1").ToString()
txtplot.Text = dr("plotno").ToString()
DateTimePicker2.Value = dr("pruning").ToString()
DateTimePicker3.Value = dr("start").ToString()
txthi.Text = dr("hi").ToString()
DateTimePicker4.Value = dr("end").ToString()
txthi1.Text = dr("hi1").ToString()
txtduration.Text = dr("duration").ToString()
txtuk.Text = dr("uk").ToString()
txtholland.Text = dr("holland").ToString()
txtgulf.Text = dr("gulf").ToString()
txtmalaysia.Text = dr("maleysia").ToString()
txtlocal.Text = dr("local").ToString()
txtbedana.Text = dr("bedana").ToString()
txttotal.Text = dr("total").ToString()

Else
MessageBox.Show("record not found please retry ", "failure", MessageBoxButtons.OK)
End If
End Sub

Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click
GroupBox1.Visible = False

Dim strupdate As String
co = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\varsha2011\plotdetails\plotdetails\harvesting.mdb;")
strupdate = "UPDATE harvesting SET date1=#" & DateTimePicker1.Value & "#, plotno=" & CInt(txtplot.Text) & ", pruning=#" & DateTimePicker2.Value & "#, start=#" & DateTimePicker3.Value & "#, hi=" & CInt(txthi.Text) & ", end=#" & DateTimePicker4.Value & "#, hi1=" & CInt(txthi1.Text) & ", duration=" & CInt(txtduration.Text) & ", uk=" & CInt(txtuk.Text) & ", holland=" & CInt(txtholland.Text) & ", gulf=" & CInt(txtgulf.Text) & ", maleysia=" & CInt(txtmalaysia.Text) & ", local=" & CInt(txtlocal.Text) & ", bedana=" & CInt(txtbedana.Text) & ", total=" & CInt(txttotal.Text) & " WHERE fileno=" & txtse.Text & ""
MsgBox(strupdate)
cm = New OleDbCommand(strupdate, co)


co.Open()
cm.ExecuteNonQuery()


MessageBox.Show("updates successfully", "update", MessageBoxButtons.OK)
co.Close()

End Sub


End Class

what error said?
in which line?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.