Home > Software engineering >  28 stack overflow error in real time
28 stack overflow error in real time

Time:10-14

MCU and PC serial communication, VB PC interface, VB operation after a period of time will prompt real-time 28 stack overflow error, what reason be,
A line error in red word,
 Dim rsJin As New ADODB. You 
If rsJin. State Then rsJin. Close
rsJin. Open the "select top 1 * from data save," dbconn, adOpenKeyset, adLockPessimistic
RsJin. AddNew
RsJin. Fields (" Date ")=Date
RsJin. Fields (" Time ")=Time
RsJin. Fields (" sensor (1)=filedata3 (num)
RsJin. Fields (4 "sensor")=filedata6 (num)
RsJin. Fields (2 "sensor")=filedata5 (num)
RsJin. Fields (3 "sensor")=filedata4 (num)
RsJin. Fields (" alpha ")=filedata1 (num)
RsJin. Fields (" beta ")=filedata2 (num)
RsJin. Update
Dim rs1 As New ADODB. You
If rs1. State Then rs1. Close 'distance monitoring is now the latest 60 records, and the status is displayed in the diagram, If into database interval is 1 second, that is the recent data within 60 seconds
Rs1. Open the "select top 30 * from data preservation order by desc" time, dbconn, adOpenKeyset, adLockPessimistic

Num=num + 1

CodePudding user response:

Your code ever form infinite recursion, or recursive calls too deep,

CodePudding user response:

I didn't use recursion, recursion is not call themselves

CodePudding user response:

Look at your code is not all, but noticed a detail.
RsJin is defined on the spot, and then add a record. Also didn't see the close code
However you is likely this record has been added.
If there are tens of thousands of new records to add, then to define and also open so many times? Efficiency under
Second, since the rsJin is defined on the spot If rsJin. State Then rsJin. Close it is to take off pants break wind.

I suggest you to define rsJin as global, the beginning of the program is open, then every time to add a record, at the end of the program shut down

It's like to go to the drawer to put a lot of things, you don't have to open the drawer every time, and then put a thing, to close the drawer again, and then open the drawer, put... This looks very tired.
  • Related