Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

works in firefox but not IE...need help

Status
Not open for further replies.

ulio

IS-IT--Management
Oct 2, 2003
28
0
0
US
Can anyone out there help me out and tell me why the following code will only work when accessed using the firefox web browser?

set commanderworker= server.CreateObject ("adodb.command")

commanderworker.ActiveConnection = objconn
commanderworker.CommandText = "SELECT * FROM mother WHERE worker = '" & authworker1 &"' and status is null"
commanderworker.CommandType=adCmdText
set objrs = commanderworker.Execute
set commanderworker = nothing

while not objrs.eof %>
<SELECT name="ticketselect" ID="Select1">
<% response.Write "<option>" & objrs("ticket number") & "</option>"
objrs.movenext
wend


now i use the same chunk of code (other than the object names and variables) in other pages, and it works just fine....and there is no error, IE acts like there is no information to be displayed, and when i take out the "while" loop stuff, IE screams about BOF and EOF error....but at the same time firefox has no issue what so ever...i am so confused by this!!!! help1!!!
 
does the data you return contain any single quotes...

try this:
Code:
<% response.Write "<option>" & Replace(objrs("ticket number"),"'","''") & "</option>"

-DNG


 
thanks for the quick response DNG.......gave it a try...no dice.

its weird cause its not even giving me a blank select box or anything in IE.
 
i dont see a value for the options in your select box...try putting the value and see if it makes any change...

-DNG
 
Since you get the EOF error, that seems to be like the query is not returning any results.

Try adding a Response.Write in there to print your SQL query and see what you get... perhaps the variable authworker1 does not contain the value that it should?
 
DNG....still no dice on it.


i've been throwing the response.writes out there, and as long as the statement is outside the "while not objrs.eof" - "wend" area, it will give me information....almost like it drops all information, including the <select> stuff. its killing me because i do this in other areas without a hitch.

as a side frustration, does it make sense that this code works perfectly fine with Firefox?
 
clarify when i said "almost like it drops all information, including the <select> stuff."

what i mean is that it drops all information if its in the "while not"


thanks
 
do this and tell us what you find:
Code:
while not objrs.eof %>
   response.write objrs("ticket number")&"</br>"
   objrs.movenext
    wend

-DNG
 
after the change, the results are:

IE: nothing displed

Firefox: displays the ticket numbers



wtf
 
hmm..i dont know what to say...does it give any error message or anything in IE??

-DNG
 
hahaha....i wish...nothing at all....i think i might be hosed here....
 
Check "View Source" in Internet Exploder and make sure its not just a rendering problem... wouldnt be suprised since your <select> tag is inside the loop.
 
Also, don't need an ADO Command object if you already have a valid ADO Connection object, which I assume you do because of the name of the variable objconn.

Code:
'Is our connection any good?
if (objconn.State <> 1) then
  Response.Write "ADO Connection is closed."
  Response.End
end if


sSQL = "SELECT * FROM mother WHERE worker = '" _
       & authworker1 & "' and status is null"

Response.Write "<br><br>" & sSQL & "<br><br>"

'Get recordset using the connection object
set objrs = objconn.Execute

'Check that we got a valid recordset:
if (objrs.State <> 1) then
  Response.Write "ADO Error"
  Response.End
end if

'Make sure we actually got some records:
if objrs.EoF then
  Response.Write "No records"
  Response.End
end if
%>

<!-- Put the select tag outside the loop -->

<SELECT name="ticketselect" ID="Select1">  
                          

<%
  ' now build the <option> tags inside the loop  
  Do While not objrs.eof 
%>
  <option value="<%= objrs("ticket number")%>">
    <%= objrs("ticket number")%>
   </option>
<%
  objrs.movenext
Loop
%>
 
but Sheco,

i even suggested this one suspecting the select tags inside the loop...

while not objrs.eof %>
response.write objrs("ticket number")&"</br>"
objrs.movenext
wend

even this one failed?? you think of any reason...

-DNG
 
I'm thinking that since the ASP runs on the server then the browser shouldnt matter at all.

So either there is a problem with the request made by the browser so that authworker1 is empty OR the server code is working the same for both and we are seeing a difference in how the result is rendered in the different browsers.
 
I'm also thinking this is an HTML problem and not ASP. Sheco pointed out that the select is in the loop. Try:

Code:
if not objrs.BOF and not objrs.EOF then
repsonse.write" <SELECT name=""ticketselect"" ID=""Select1"">" & vbcrlf
  
 while not objrs.eof 
 
response.Write "<option value="""& objrs("ticket number") &""">" & objrs("ticket number") & "</option>"
    objrs.movenext
    wend
response.write "</select>" & vbcrlf
end if

If IE is not displaying anything, then as already suggested, do a view source - there probably is an output but you're not seeing it.

- Lending webmasters a helping hand
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top