Hi
I wonder how I can compare each element from one queryresult with all elements in another in a good way?
My code:
sql = "SELECT journal_id FROM usersjournals,user where usersjournals.user_id=user.user_id and user.user_name='"&Request.Form("user_name"&"'"
set objRS =objCommand.execute(sql)
sql = "SELECT * FROM journal"
set objRS2 =objCommand.execute(sql)
' in both tables the journal_id occur
' I want to write "checked" if the journal_id exist in usersjournals, I think it will be something like this:
while not objRS.EOF
while not objRS2.EOF
if objRS("journal_id"=objRS("journal_id" then
Response.Write "checked"
end if
objRS2.MoveNext
Wend
objRS.MoveNext
Wend
'But this is not good programming. Could I use an array or list instead? How could I do that? Or if I should do it the way I have done, how to I set objrs2 to start over?
JAA
I wonder how I can compare each element from one queryresult with all elements in another in a good way?
My code:
sql = "SELECT journal_id FROM usersjournals,user where usersjournals.user_id=user.user_id and user.user_name='"&Request.Form("user_name"&"'"
set objRS =objCommand.execute(sql)
sql = "SELECT * FROM journal"
set objRS2 =objCommand.execute(sql)
' in both tables the journal_id occur
' I want to write "checked" if the journal_id exist in usersjournals, I think it will be something like this:
while not objRS.EOF
while not objRS2.EOF
if objRS("journal_id"=objRS("journal_id" then
Response.Write "checked"
end if
objRS2.MoveNext
Wend
objRS.MoveNext
Wend
'But this is not good programming. Could I use an array or list instead? How could I do that? Or if I should do it the way I have done, how to I set objrs2 to start over?
JAA