Home > Software engineering >  VB programming the real-time acquisition of serious problem!
VB programming the real-time acquisition of serious problem!

Time:09-30

 Public cn As New ADODB. Connection 
Public rs As New ADODB. You
Public As SQL String

Private Sub Timer1_Timer ()
Call ReadDA100 (m_GetDA100 (), COM1) 'acquisition DA100
Cn. Open the Provider="Microsoft. ACE. The OLEDB. 12.0; Data Source="+ App. Path & amp; "Database \ " & amp; Bisoshi & amp; ". Accdb "& amp; "; The Jet OlEDB: Database
"SQL="select * from" & amp; "" & amp; Biaoshi & amp; "Order by testing time asc"
Rs. The Open SQL, cn, 1, 3
Rs. AddNew
Rs. Fields (0)=time_start (j, I)
Rs. Fields (1)=Format (Now, "yyyy/mm/dd hh: mm: ss")
Rs. Fields (2)=strQiHouLeiXing
Rs. Fields (3)=strHuanJingWenDu (j, I)
Rs. Update
Rs. Close
Set the rs=Nothing
Cn. Close
The Set cn=Nothing
End Sub

On the above procedure is used to collect real-time temperature data, DA100 module is not listed, there is a problem now, is gathering around 23:58 points is always interrupt, do not know why?
Urgent please solve!

CodePudding user response:

Post your Timer setting code see,

May be associated with across a midnight, the system Time to zero,

CodePudding user response:

What is called the interrupt! What is the error information?
Don't see variable bisoshi, I, j, time_start (), strHuanJingWenDu (), and each time the Timer () event in the relationship,

CodePudding user response:

Reply 1/f, the Timer set up its intervaal for 65000 only, other nothing set,

CodePudding user response:

The second floor, there is no error message is procedures have no reaction, and then open the database found around 23:58 points is not recorded

CodePudding user response:

To change the system time, had step through the program, see where is stuck,

CodePudding user response:

Once made for a long period of time the Timer cycle repeated work, possible feign death, for unknown reasons, then USES the task plan time start the program to solve,

CodePudding user response:

Run die, long running program is wrong, such as memory leaks,
Use the task manager to monitor the program memory and handle to change,

CodePudding user response:

refer to 7th floor Tiger_Zhao response:
run run for a long time dead, clear program has fault, such as memory leaks,
Use task manager to monitor the program memory and handle change,

CodePudding user response:

Set the rs=Nothing
The Set cn=Nothing
The two sentences

CodePudding user response:

Why not use the insert statement?

CodePudding user response:

 
Public cn As ADODB. Connection 'New remove
Public rs As ADODB. You 'New remove
Public As SQL String
Private Sub Timer1_Timer ()
Call ReadDA100 (m_GetDA100 (), COM1) 'acquisition DA100
Set the cn=new ADODB. Connection
Cn. Open the Provider="Microsoft. ACE. The OLEDB. 12.0; Data Source="+ App. Path & amp; "Database \ " & amp; Bisoshi & amp; ". Accdb "& amp; "; The Jet OlEDB: Database
"SQL="select * from" & amp; "" & amp; Biaoshi & amp; "Order by testing time asc"
Set the rs=new ADODB. You
Rs. The Open SQL, cn, 1, 3
Rs. AddNew
Rs. Fields (0)=time_start (j, I)
Rs. Fields (1)=Format (Now, "yyyy/mm/dd hh: mm: ss")
Rs. Fields (2)=strQiHouLeiXing
Rs. Fields (3)=strHuanJingWenDu (j, I)
Rs. Update
Rs. Close
Set the rs=Nothing
Cn. Close
The Set cn=Nothing
End Sub
  • Related