Home > front end > Asp access two tables should satisfy the conditions in the first table to perform the operation of t
Asp access two tables should satisfy the conditions in the first table to perform the operation of t
Time:12-04
Asp + access environment, with two tables in a database, table 1 and table 2, only one row in the table 1 and table 2 N rows, this statement is to conform to the conditions in table 2 of multiple records its field verity value automatically into 1, but now is to add a premise condition is: if the auto fields in table 1=1 to perform the following statement, I do not know how to add the code in front of this statement, please the great god glad
Set the rs=Server. CreateObject (" ADODB. You ") StrSql="select top 100 id from table 2 where verity=0 and Clicks> Zero order by on desc "Rs. The open StrSql, Conn, 1, 1 If not rs. Eof and not rs. Bof then If the rs (" on ") & gt; 1 then Set verity szupdate="update table 2=1 where id=" & amp; Rs (" id ") & amp;" " End the if Conn. Execute szupdate End the if Response. Write "the update is successful!" End the if Rs. Close Set the rs=nothing
CodePudding user response:
if conn. Execute (" Select [auto] From [1] ") (0)=1 then Conn. Execute (" update table 2 set verity=1 where verity=0 and Clicks> 1 and id="& amp; Rs (" id ")) End the if