Hello Everyone,
I have a project called Bus Tires monitoring System, The project consist of RFID technology which is each tires has an embedded RFID tag somewhere inside the tire and each RFID tag is uniquely assigned to each tire. Assuming that each RFID tag already branded with an Item ID in the sqlce database in the handheld.The application will scan all tags detected and display in the result in the listview if the RFID tagid found in the database it will display the Item ID in listview otherwise it will display "RFID tag unassigned". to make the story short. the application need to query the database over and over for each tagid detected and check if the tagid matches the record in the database. The process slows down dramatically as the record increases in the database.
Is there any other better solution than the code i have below? something like loading all the records at once in the dataset and query the dataset?. I have not tried dataset query before any suggestions?.
This code will return the results in string array, this function being called over and over and each scanned Tagid
Thank you.
Regards
I have a project called Bus Tires monitoring System, The project consist of RFID technology which is each tires has an embedded RFID tag somewhere inside the tire and each RFID tag is uniquely assigned to each tire. Assuming that each RFID tag already branded with an Item ID in the sqlce database in the handheld.The application will scan all tags detected and display in the result in the listview if the RFID tagid found in the database it will display the Item ID in listview otherwise it will display "RFID tag unassigned". to make the story short. the application need to query the database over and over for each tagid detected and check if the tagid matches the record in the database. The process slows down dramatically as the record increases in the database.
Is there any other better solution than the code i have below? something like loading all the records at once in the dataset and query the dataset?. I have not tried dataset query before any suggestions?.
This code will return the results in string array, this function being called over and over and each scanned Tagid
Code:
Public Function GetScanInfo(ByVal TagID As String) As String() 'get record infp
Dim result() As String = Nothing
'check if the tag is a Tire
'0- Tire ID
'1-Location
'2-Bus Number
'3-Tire (Image index)
'4- Mileage (Accumulated Mileage)
'5- Vehicle Mileage at install
'6 - mounting
'7- tagid
'8- tire brand and type
'9- tire size
'10 -psi
'11- installed date
'12-tread at install
'13-bus mileage at install
'14-branding date
'15-installed
'16-tread at removal
'17-removal date
'18-Operator Name
'19- Disposal Date
'Dim rs As New SqlCeDataAdapter("SELECT TireID,Location,BusNumber,Mileage as AccuMileage,[Vehicle mileage_Ins],Mounting,RFID FROM Tire WHERE RFID='" & TagID & "'", _DBConn_LOCAL)
Dim rs As New SqlCeDataAdapter("SELECT tire.*,TireType.psi FROM Tire,TireType WHERE RFID='" & TagID & "' AND Tire.model=TireType.TireBrandType", _DBConn_LOCAL)
Dim dt As New Data.DataTable("Tire")
rs.Fill(dt)
If dt.Rows.Count <> 0 Then 'tire
With dt.Rows(0)
result = New String() {dt.Rows(0).Item("TireID").ToString, dt.Rows(0).Item("Location").ToString, dt.Rows(0).Item("BusNumber").ToString, "Tire", dt.Rows(0).Item("Mileage").ToString, dt.Rows(0).Item("Vehicle mileage_Ins").ToString, dt.Rows(0).Item("Mounting").ToString, dt.Rows(0).Item("RFID").ToString, .Item("Model").ToString, .Item("Tire Size").ToString, .Item("psi").ToString, .Item("Installation Date").ToString, .Item("Tread_Depth_Ist").ToString, .Item("Vehicle Mileage_Ins").ToString, .Item("InitialBrandingDate").ToString, .Item("Installed").ToString, .Item("Tread_Depth_Rem").ToString, .Item("Removal Date").ToString, .Item("Operator Name").ToString, .Item("Disposal Date").ToString}
End With
rs = Nothing
dt = Nothing
Else
'check if the tag is a Bus
rs = New SqlCeDataAdapter("SELECT * FROM Bus WHERE [RFID]='" & TagID & "'", _DBConn_LOCAL)
dt = New DataTable("Bus")
rs.Fill(dt)
If dt.Rows.Count <> 0 Then
result = New String() {dt.Rows(0).Item("SerialNumber").ToString, dt.Rows(0).Item("Model").ToString, dt.Rows(0).Item("mkMileAge").ToString, "Bus", TagID, dt.Rows(0).Item("Tires").ToString, "", TagID}
rs = Nothing
dt = Nothing
Else ' if the tag did not match for Tire or Bus then this tag is not yet assigned
result = New String() {"Unassigned", "Unassigned Tag", TagID, "Unknown", "", "", "", TagID}
End If
End If
Return result
End Function
Thank you.
Regards