0

I have Follwing Screenshot & Code help me ?
'' code for browse Button

If maxrowsd2 = 0 Then
Console.WriteLine(" There are No Records in the table")
Exit Sub
End If
If incd2 <> maxrowsd2 - 1 Then
incd2 = incd2 + 1
Call navigaterecord2()
ElseIf incd2 = maxrowsd2 - 1 Then
incd2 = -1
incd2 = incd2 + 1
Call navigaterecord2()
Console.WriteLine(" Record Not Found ")
'MsgBox(" Record Not Found")
Exit Sub
End If
Public Sub navigaterecord2()
Try
TextBox1.Text = ds2.Tables("Station2s").Rows(incd2).Item("Partno")
TextBox2.Text = ds2.Tables("Station2s").Rows(incd2).Item("Qty")
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub

Now Code to add record in another table
If Trim(TextBox1.Text) = "" Then
MessageBox.Show("Please Select Part Number ")
Exit Sub
End If
Dim commobjdu2st As New common
Try
commobjdu2st.query = " Insert into station2(partno,qty,Statusford2,dtstamp,Flagstart,Flagstarts2) values ('" & Trim(TextBox1.Text) & "','" & Trim(TextBox2.Text) & "','" & "WIP" & "','" & Format(Date.Now, "d") & "',Yes,yes)"
commobjdu2st.M_ExecuteQry()
MessageBox.Show("Record Added")
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
commobjdu2st = Nothing
End Try

end sub

Now To delete record code is as

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim commobjD2Fi As New common
Try
'commobjD1Fi.query = " Insert into station1finish(partno,qty,finishstatus,Dtstamp) values('" & Trim(TextBox1.Text) & "','" & Trim(TextBox2.Text) & "','" & "finish" & "','" & Format(Date.Now, "d") & "')"
' commobjD2Fi.query = " update station1 set flagfinishs2 =Yes where partno='" & Trim(TextBox1.Text) & "' and qty = '" & Trim(TextBox2.Text) & "'"
commobjD2Fi.query = " update station2 set flagfinish =Yes where partno='" & Trim(TextBox1.Text) & "' and qty = '" & Trim(TextBox2.Text) & "'"
commobjD2Fi.M_ExecuteQry()
Catch ex As Exception
MsgBox(ex.Message)
MsgBox(Err.Number & "-" & Err.Description)
Finally
commobjD2Fi = Nothing
End Try
' For Deletion of record from Du1
Dim commobjD2De As New common
Try
commobjD2De.query = " Delete from station1 where partno ='" & Trim(TextBox1.Text) & "' And qty = '" & Trim(TextBox2.Text) & "'"
commobjD2De.M_ExecuteQry()
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = ""
TextBox4.Text = ""
'PartNoN.Caption = " "
'QryN.Caption = " "
'PictureBox1.Image = Nothing
'm_frmdu2.Timer2.Enabled = True
Catch ex As Exception
MsgBox(ex.Message)
MsgBox(Err.Number & "-" & Err.Description)
Finally
commobjD2De = Nothing
End Try
End Sub

Now I want to Know where i Put this code so that i cant get records after deletion in next browse . I used Form activate Event & timer control also .

conn2 = New OleDbConnection(connstr)
conn2.Open()
sql2 = " Select * from Station1 where dtstamp = " & "#" & Format(Date.Now, "d") & "#" & ""
da2 = New OleDbDataAdapter(sql2, conn2)
da2.Fill(ds2, "Station2s")
conn2.Close()
maxrowsd2 = ds2.Tables("Station2s").Rows.Count
incd2 = -1
the above code is requred for browse

3
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by Jx_Man
0

yes..use attachment facility in this forum.
click on "Go Advanced" and looks for an attachment manage.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.