Home > Software engineering >  VB under update SQL database
VB under update SQL database

Time:09-23

 
SQL3=SQL3 + "SELECT top & amp;" MyValue & amp; "* FROM TB_pts_product
"SQL3=SQL3 + "WHERE (=N 'ProductCode" & amp; DHBH & amp; "')
"SQL3=SQL3 + "AND" (OrderNo=N '" & amp; DH & amp; "') AND (PackageLevel=1) AND the Status=0"
SQL3=SQL3 + "ORDER BY ID"
TRecSql3. Open SQL3, CN

SQL4=SQL4 + "SELECT * FROM TB_pts_product"
SQL4=SQL4 + "WHERE (=N 'ProductCode" & amp; DHBH & amp; "')
"SQL4=SQL4 + "AND" (OrderNo=N '" & amp; DH & amp; "') AND (PackageLevel=2)
"SQL4=SQL4 + "ORDER BY ID"
TRecSql4. Open SQL4, CN

While Not tRecSql3. EOF
If tRecSql4. EOF=True Then
The Else
LBL3=tRecSql4! Id
TRecSql4. MoveNext
End the If

For I=1 To 10
LBL1=tRecSql3! QRCode
LBL2=tRecSql3! Id
TRecSql3. MoveNext


SqlPTS=""
SqlPTS="UPDATE TB_pts_product SET Status=1, SAPNo=N '" & amp; SapNO_PTS & amp; "', ProduceDate=N '" & amp; Now () & amp; "', OuterQrCodeID=N '" & amp; LBL3 & amp; "' the WHERE (ID=" & amp; LBL2 & amp;
")" CN. The Execute sqlPTS Next
I
Wend

The purpose is to

Every 10 PackageLevel=1 data matching a PackageLevel=2
But now a database to UPDATE statement execution will timeout

great god, please help!

CodePudding user response:

Database timeout
Can you give my data value ascribed to two arrays?? The assignment of database connection is released, and then to the execution of the UPDATE statement

Don't write array assignment and circulation, can help

CodePudding user response:

Write a trigger, or a stored procedure, VB call directly,
  • Related