Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_discuss thread: Why does this Happen???


Message #1 by "Dave Landolin" <dave.landolin@o...> on Tue, 11 Jun 2002 16:48:29
OK. I give up.
Can anyone explain to me why the word "TEST" in this code prints BEFORE 
the table???

<%@ language="vbscript" %>
<% set dbconn = server.createobject("ADODB.Connection")
dbconn.open "DSN=Stuff;uid=sa;password="
set dbcmd = server.createobject("ADODB.Command")
set dbcmd.activeconnection = dbconn

dim sqlstr, sql2

sql1 = "select distinct shipped_to_name, address1, address2, city, "
sql1 = sql1 + "state, zip " 
sql1 = sql1 + "from ds_detail " 
sql1 = sql1 + "where customer_id = '700037'"
dbcmd.commandtext = sql1
set rs = server.createobject("ADODB.recordset")
set rs = dbcmd.execute

    STName = rs("shipped_to_name")
    
    sql2 = "select * from ds_detail where shipped_to_name = '" & STNAme 
& "'"
    dbcmd.commandtext = sql2
    set rs2 = server.createobject("ADODB.recordset")
    set rs2 = dbcmd.execute

'*** Name and address of customer
response.write rs("shipped_to_name") & "<br>" & rs("address1") & "<br>" & 
rs("address2") & "<br>" & rs("city") & ", " & rs("state") & " " & left(rs
("zip"),5) & "<p>"

'*** Table is created here. ***
With Response
        .write "<html>"
        .write "<body>"
        .write "<table border='1' cellspacing='0' width='50%'>"
          .write "<tr>"
           .write "<td width='33%' style='font-family: Arial; font-size: 
10pt; text-align: Center'>Item</td>"
           .write "<td width='33%' style='font-family: Arial; font-size: 
10pt; text-align: Center'>Item Description</td>"
           .write "<td width='33%' style='font-family: Arial; font-size: 
10pt; text-align: Center'>Amount</td>"
           .write "<td width='33%' style='font-family: Arial; font-size: 
10pt; text-align: Center'>Rebate</td>"
           .write "</tr>"    
End With
'*** Table has been created. ***
    
'*** Why does this appear above the table???? ***

response.write "TEST"

%>

Thanks in advance for your help.
dl
Message #2 by "Tim Morford" <tmorford@n...> on Tue, 11 Jun 2002 12:02:04 -0400
I think it has to do with the way html is displayed in the browser, try
closing the table then see what happens

.write "</tr>"
.write "</TABLE>"
End With
'*** Table has been created. ***

'*** Why does this appear above the table???? ***

response.write "TEST"

Tim Morford
http://www.speaking-of.net
http://www.aspalliance.com/tmorford

-----Original Message-----
From: Dave Landolin [mailto:dave.landolin@o...]
Sent: Tuesday, June 11, 2002 4:48 PM
To: asp_discuss
Subject: [asp_discuss] Why does this Happen???


OK. I give up.
Can anyone explain to me why the word "TEST" in this code prints BEFORE
the table???

<%@ language="vbscript" %>
<% set dbconn = server.createobject("ADODB.Connection")
dbconn.open "DSN=Stuff;uid=sa;password="
set dbcmd = server.createobject("ADODB.Command")
set dbcmd.activeconnection = dbconn

dim sqlstr, sql2

sql1 = "select distinct shipped_to_name, address1, address2, city, "
sql1 = sql1 + "state, zip "
sql1 = sql1 + "from ds_detail "
sql1 = sql1 + "where customer_id = '700037'"
dbcmd.commandtext = sql1
set rs = server.createobject("ADODB.recordset")
set rs = dbcmd.execute

    STName = rs("shipped_to_name")

    sql2 = "select * from ds_detail where shipped_to_name = '" & STNAme
& "'"
    dbcmd.commandtext = sql2
    set rs2 = server.createobject("ADODB.recordset")
    set rs2 = dbcmd.execute

'*** Name and address of customer
response.write rs("shipped_to_name") & "<br>" & rs("address1") & "<br>" &
rs("address2") & "<br>" & rs("city") & ", " & rs("state") & " " & left(rs
("zip"),5) & "<p>"

'*** Table is created here. ***
With Response
        .write "<html>"
        .write "<body>"
        .write "<table border='1' cellspacing='0' width='50%'>"
          .write "<tr>"
           .write "<td width='33%' style='font-family: Arial; font-size:
10pt; text-align: Center'>Item</td>"
           .write "<td width='33%' style='font-family: Arial; font-size:
10pt; text-align: Center'>Item Description</td>"
           .write "<td width='33%' style='font-family: Arial; font-size:
10pt; text-align: Center'>Amount</td>"
           .write "<td width='33%' style='font-family: Arial; font-size:
10pt; text-align: Center'>Rebate</td>"
           .write "</tr>"
End With
'*** Table has been created. ***

'*** Why does this appear above the table???? ***

response.write "TEST"

%>

Thanks in advance for your help.
dl

Message #3 by "Scott Reed" <scottr@m...> on Tue, 11 Jun 2002 12:22:22 -0500
Try assigning the "TEST" string to a variable and
r.w the variable. 

-----Original Message-----
From: Dave Landolin [mailto:dave.landolin@o...]
Sent: Tuesday, June 11, 2002 4:48 PM
To: asp_discuss
Subject: [asp_discuss] Why does this Happen???


OK. I give up.
Can anyone explain to me why the word "TEST" in this code prints BEFORE 
the table???

<%@ language="vbscript" %>
<% set dbconn = server.createobject("ADODB.Connection")
dbconn.open "DSN=Stuff;uid=sa;password="
set dbcmd = server.createobject("ADODB.Command")
set dbcmd.activeconnection = dbconn

dim sqlstr, sql2

sql1 = "select distinct shipped_to_name, address1, address2, city, "
sql1 = sql1 + "state, zip " 
sql1 = sql1 + "from ds_detail " 
sql1 = sql1 + "where customer_id = '700037'"
dbcmd.commandtext = sql1
set rs = server.createobject("ADODB.recordset")
set rs = dbcmd.execute

    STName = rs("shipped_to_name")
    
    sql2 = "select * from ds_detail where shipped_to_name = '" & STNAme 
& "'"
    dbcmd.commandtext = sql2
    set rs2 = server.createobject("ADODB.recordset")
    set rs2 = dbcmd.execute

'*** Name and address of customer
response.write rs("shipped_to_name") & "<br>" & rs("address1") & "<br>" & 
rs("address2") & "<br>" & rs("city") & ", " & rs("state") & " " & left(rs
("zip"),5) & "<p>"

'*** Table is created here. ***
With Response
        .write "<html>"
        .write "<body>"
        .write "<table border='1' cellspacing='0' width='50%'>"
          .write "<tr>"
           .write "<td width='33%' style='font-family: Arial; font-size: 
10pt; text-align: Center'>Item</td>"
           .write "<td width='33%' style='font-family: Arial; font-size: 
10pt; text-align: Center'>Item Description</td>"
           .write "<td width='33%' style='font-family: Arial; font-size: 
10pt; text-align: Center'>Amount</td>"
           .write "<td width='33%' style='font-family: Arial; font-size: 
10pt; text-align: Center'>Rebate</td>"
           .write "</tr>"    
End With
'*** Table has been created. ***
    
'*** Why does this appear above the table???? ***

response.write "TEST"

%>

Thanks in advance for your help.
dl
Message #4 by "Dave Landolin" <dave.landolin@o...> on Tue, 11 Jun 2002 20:28:33
Thanks Tim.
The missing </table> tag was the problem.

  Return to Index