Brian2sos 0 Newbie Poster

Hello all you geniuses out there... Long time reader first time poster,

So, here is what I'm trying to do.

The program I am trying to construct is for tracking when a person has entered a location. Each person has an RFID card. When a person passes a point, the RFID tag is read and the reader outputs virtual keystrokes. The reader keyboard wedge will output a 6 digit integer.

The program will be left on the run screen, each time a card is read it is placed into a multi-line text box. Every 15 mins or so, the program must read each of the 6 digit numbers, locate them in the database, and change the number of times the card has been read and the time it was read.

What I have so far

So I have no problem creating a data set and filtering that data set and also I have no problem creating user info and writing that to the database. The problem I have is searching for a specific record in my database and then having the program change certain data and update the database.


Here is a sample program I made to test my search method

Public Class Main

    Private Sub ListingBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListingBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.ListingBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.CarTrackerDataSet)

    End Sub

    Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'CarTrackerDataSet.CarType' table. You can move, or remove it, as needed.
        Me.CarTypeTableAdapter.Fill(Me.CarTrackerDataSet.CarType)
        'TODO: This line of code loads data into the 'CarTrackerDataSet.Make' table. You can move, or remove it, as needed.
        Me.MakeTableAdapter.Fill(Me.CarTrackerDataSet.Make)
        'TODO: This line of code loads data into the 'CarTrackerDataSet.Color' table. You can move, or remove it, as needed.
        Me.ColorTableAdapter.Fill(Me.CarTrackerDataSet.Color)
        'TODO: This line of code loads data into the 'CarTrackerDataSet.Listing' table. You can move, or remove it, as needed.
        Me.ListingTableAdapter.Fill(Me.CarTrackerDataSet.Listing)

    End Sub


    Private Sub FillByColorNameToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FillByColorNameToolStripButton.Click
        Try
            Me.ListingTableAdapter.FillByColorName(Me.CarTrackerDataSet.Listing, ColorNameToolStripTextBox.Text)
        Catch ex As System.Exception
            System.Windows.Forms.MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub tsbFilterByMake_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbFilterByMake.Click
        Dim filteredByMake = From Listing In Me.CarTrackerDataSet.Listing _
                             Join Make In Me.CarTrackerDataSet.Make _
                             On Listing.MakeID Equals Make.MakeID _
                             Where Make.MakeName.ToLower() Like _
                             "*" & Me.tstbFilterByMake.Text.ToLower() & "*" _
                             Select Listing

        Try
            Me.ListingBindingSource.DataSource = filteredByMake.CopyToDataTable
        Catch ex As System.InvalidOperationException
            MessageBox.Show("No matching data")
        End Try

    End Sub

    Private Sub tsbFilterByCarType_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbFilterByCarType.Click
        Dim filteredByCarType = From Listing In Me.CarTrackerDataSet.Listing _
                                Join CarType In Me.CarTrackerDataSet.CarType _
                                On Listing.CarTypeID Equals CarType.CarTypeID _
                                Where CarType.CarTypeName.ToLower() Like _
                                "*" & Me.tstbFilterByCarType.Text.ToLower() & "*" _
                                Select Listing

        Try
            Me.ListingBindingSource.DataSource = filteredByCarType.CopyToDataTable
        Catch ex As System.InvalidOperationException
            MessageBox.Show("No matching data")
        End Try

    End Sub
End Class

Any ideas??