944,100 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 532
  • VB.NET RSS
Nov 6th, 2009
0

vb.net, database manipulation

Expand Post »
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

VB.NET Syntax (Toggle Plain Text)
  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??
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Brian2sos is offline Offline
1 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Printing in VB.NET
Next Thread in VB.NET Forum Timeline: Protect Sheet with VBA





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC