Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,
I have 10 labels each labels consists of different numeric values which gets updated every 2 ms.now i am trying to save these datas to my access database in a row by row format every 10 ms.So every 1 sec my access database should be updated with 100 rows of data.i am using the below code inside a timer ,but i can only manage to insert 20 rows.is there any possible ways to achieve this,or am i using a wrong approach.please help me out.

thanks

VB
Dim datacomm As String
   Private Sub GetUpdates()
       Try
           datacomm = "insert into datatable1 ([date_], [time_], [data1], [data2], [data3], [data4], [data1_av], [data2_av],[data3_av],[data4_av],[filename]) values ('" _
                      & DateString & "',0,'" & Label138.Text & "','" & Label140.Text & "','" & Label142.Text & "','" & Label144.Text & "','" & Label134.Text & "','" & Label137.Text & _
                      "','" & Label133.Text & "','" & Label93.Text & "','" & My.Settings.excelfilename & "')"
           Dim cmd As New OleDbCommand(datacomm, myConn)
           cmd.ExecuteNonQuery()
       Catch ex As Exception
       End Try
   End Sub
Posted
Updated 26-Dec-15 8:17am
v2
Comments
Mehdi Gholam 26-Dec-15 8:54am    
Access is not built for high velocity/volume data, look into changing your architecture.
manoj sundar 26-Dec-15 9:12am    
thank you for your suggestion.but i have not used any database other than access.please suggest me any other ways or alternates.i ll record a maximum of 10 seconds of data at a stretch (i.e. maximum of 1000 rows of data).
[no name] 26-Dec-15 12:54pm    
"No" database is basically build for such high velocity/volume. Depending on the Situation, a temp. file can help. But that is really much depending whether the high volume occures periodically or not. In case not (constant high load) it will not help :(
manoj sundar 27-Dec-15 0:51am    
thank you for your reply ,i ll be updating the database periodicaly.but i think i have to learn some other efficient way to achieve this
manoj sundar 27-Dec-15 0:55am    
hi dave,
thanks for your solution.could you guide me more about this concept "you just cache that data in memory. When the capture is complete, then you can parse that data and write it to the database"

1 solution

You don't write to the database every 10ms. If you're going to capture 10 seconds worth of data, you just cache that data in memory. When the capture is complete, then you can parse that data and write it to the database.

What you're doing isn't going to work and isn't going to work as fast as you want.

On top of that, you opened your code up to SQL Injection Attacks which can risk the complete loss of your database. Use parameterized queries. Google for "vb.net parameterized query" and start reading.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900