My data missing for first row when id_ope change when I query data from the database it shows like this below
And after coding
this is my code in ASP-classic
test = 0
for x = 0 to emailRow
id_ope = arrx(0,x)
id_boat = arrx(1,x)
bname = arrx(2,x)
' email = arrx(3,x)
body = "<table>"&arrcon&"<table>"
if id_ope&"" <> "2" then
if test = 0 then
test = id_ope
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content
elseif test = id_ope then
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content
else
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content
mailBody = body
arrcon = ""
test = id_ope
response.write mailBody
end if
end if
next
And this is my SQL query
SELECT DISTINCT TOP 30 boat.id_ope,
boat.id_boat,
boat.Name2
FROM Boat
INNER JOIN Commission ON Commission.id_boat = Boat.id_boat
WHERE Commission.Commission = '0'
ORDER BY boat.id_ope DESC;
See in comment code
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content // add value
mailBody = body
arrcon = "" //set = null
test = id_ope
response.write mailBody
I think your set arrcon = "" after add value