vb.net, database manipulation

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2009
Posts: 1
Reputation: Brian2sos is an unknown quantity at this point 
Solved Threads: 0
Brian2sos Brian2sos is offline Offline
Newbie Poster

vb.net, database manipulation

 
0
  #1
30 Days Ago
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

  1. Public Class Main
  2.  
  3. Private Sub ListingBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListingBindingNavigatorSaveItem.Click
  4. Me.Validate()
  5. Me.ListingBindingSource.EndEdit()
  6. Me.TableAdapterManager.UpdateAll(Me.CarTrackerDataSet)
  7.  
  8. End Sub
  9.  
  10. Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  11. 'TODO: This line of code loads data into the 'CarTrackerDataSet.CarType' table. You can move, or remove it, as needed.
  12. Me.CarTypeTableAdapter.Fill(Me.CarTrackerDataSet.CarType)
  13. 'TODO: This line of code loads data into the 'CarTrackerDataSet.Make' table. You can move, or remove it, as needed.
  14. Me.MakeTableAdapter.Fill(Me.CarTrackerDataSet.Make)
  15. 'TODO: This line of code loads data into the 'CarTrackerDataSet.Color' table. You can move, or remove it, as needed.
  16. Me.ColorTableAdapter.Fill(Me.CarTrackerDataSet.Color)
  17. 'TODO: This line of code loads data into the 'CarTrackerDataSet.Listing' table. You can move, or remove it, as needed.
  18. Me.ListingTableAdapter.Fill(Me.CarTrackerDataSet.Listing)
  19.  
  20. End Sub
  21.  
  22.  
  23. Private Sub FillByColorNameToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FillByColorNameToolStripButton.Click
  24. Try
  25. Me.ListingTableAdapter.FillByColorName(Me.CarTrackerDataSet.Listing, ColorNameToolStripTextBox.Text)
  26. Catch ex As System.Exception
  27. System.Windows.Forms.MessageBox.Show(ex.Message)
  28. End Try
  29.  
  30. End Sub
  31.  
  32.  
  33. Private Sub tsbFilterByMake_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbFilterByMake.Click
  34. Dim filteredByMake = From Listing In Me.CarTrackerDataSet.Listing _
  35. Join Make In Me.CarTrackerDataSet.Make _
  36. On Listing.MakeID Equals Make.MakeID _
  37. Where Make.MakeName.ToLower() Like _
  38. "*" & Me.tstbFilterByMake.Text.ToLower() & "*" _
  39. Select Listing
  40.  
  41. Try
  42. Me.ListingBindingSource.DataSource = filteredByMake.CopyToDataTable
  43. Catch ex As System.InvalidOperationException
  44. MessageBox.Show("No matching data")
  45. End Try
  46.  
  47. End Sub
  48.  
  49. Private Sub tsbFilterByCarType_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbFilterByCarType.Click
  50. Dim filteredByCarType = From Listing In Me.CarTrackerDataSet.Listing _
  51. Join CarType In Me.CarTrackerDataSet.CarType _
  52. On Listing.CarTypeID Equals CarType.CarTypeID _
  53. Where CarType.CarTypeName.ToLower() Like _
  54. "*" & Me.tstbFilterByCarType.Text.ToLower() & "*" _
  55. Select Listing
  56.  
  57. Try
  58. Me.ListingBindingSource.DataSource = filteredByCarType.CopyToDataTable
  59. Catch ex As System.InvalidOperationException
  60. MessageBox.Show("No matching data")
  61. End Try
  62.  
  63. End Sub
  64. End Class

Any ideas??
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC