The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
Hi, long time no see ppl
so... I'm writing a web app to show product listing, and I just added categories to that app.
I added this little chunk of code and it threw an error at me, Response buffer limit exceeded? never seen that one before, and I dont see any errors in my code, AND there is only ONE category in the database at the moment. Help?
I should note that the page worked flawlessly till I added that code ^^
*edit - Response.Buffer=False produced no error, however it also produced NO PAGE... no source, nothing. just a blank browser screen.
I commented out the added code with the same result... so now I dont even know if it's that code or what. The only other things I edited were a couple of SQL statements that shouldn't even be called the way the page is loading...
*edit again - ok I did a process of elimination and the code above IS whats causing the error...<
so... I'm writing a web app to show product listing, and I just added categories to that app.
I added this little chunk of code and it threw an error at me, Response buffer limit exceeded? never seen that one before, and I dont see any errors in my code, AND there is only ONE category in the database at the moment. Help?
Code:
set crs = Server.CreateObject("Adodb.RecordSet")
strsql = "SELECT Cat_Name, Cat_ID FROM P_Categories ORDER BY Cat_Name ASC"
crs.Open strsql, dbConn
if not(crs.eof) then
Do while not(crs.eof)
response.write("<option value=""" & crs("Cat_ID"))
if crs("Cat_ID") = strProductCat then
response.write(" SELECTED")
end if
response.write(""">" & formatString(crs("Cat_Name")) & "</option>")
Loop
else
response.write("<option value=""0"">No Categories Found!!!</option>")
end if
crs.close
set crs = nothing
I should note that the page worked flawlessly till I added that code ^^
*edit - Response.Buffer=False produced no error, however it also produced NO PAGE... no source, nothing. just a blank browser screen.
I commented out the added code with the same result... so now I dont even know if it's that code or what. The only other things I edited were a couple of SQL statements that shouldn't even be called the way the page is loading...
*edit again - ok I did a process of elimination and the code above IS whats causing the error...<
-Stim
Sist redigert av
Postet den
you will never exit the loop since you are not doing a movenext on the recordset.movenext, so you only ever check the same record over and over again.
<
Postet den
... something stupid, i knew it.
Thx Huw<
Thx Huw<
-Stim
Postet den
Or you may simple use GetRows and close Recordset and go with For ... Next on array, which I find less dangerous and less resource demand in most cases.<
Sist redigert av
Postet den
I could do that, and I might if this ends up getting big enough to be worried about resources. This is in extremely early development... as I havnt coded for probably 2 or 3 years... its been a while, I find I have to re-learn alot of things.
Like basic f'in HTML for example... lol
If I remember correctly if I had the following HTML code:
Then the "Select Me!" would be automatically selected... but apparently thats not the case! Not in firefox anyway... I've tried the above, I've tried <option value="whatev" selected="selected"> and neither seem to work. I've tried capitalized, lowercase, I just dont get it. I DO remember it working...<
Like basic f'in HTML for example... lol
If I remember correctly if I had the following HTML code:
Code:
<select name="whatever">
<option value="this">This</option>
<option value="that">That</option>
<option value="select me!" selected>Select Me!</option>
</select>
Then the "Select Me!" would be automatically selected... but apparently thats not the case! Not in firefox anyway... I've tried the above, I've tried <option value="whatev" selected="selected"> and neither seem to work. I've tried capitalized, lowercase, I just dont get it. I DO remember it working...<
-Stim
Postet den
In Firefox, you have to use option value selected="yes", thus:
<select name="whatever">
<option value="this">This</option>
<option value="that">That</option>
<option value="select me!" selected="yes">Select Me!</option>
</select>
<
Sist redigert av
Postet den
Looks like it should be <option value="whatever" selected="selected"> based on http://www.w3schools.com/tags/att_option_selected.asp<
Postet den
I tested it with Firefox 3 and selected="yes" works just fine.<
Postet den
If it works it works. However I've only seen it documented one of two ways - <option value="whatever" selected> and <option value="whatever" selected="selected">
The former in the fun days before XHTML, and the latter as a part of XHTML. What works is most likely going to be based partly on the DOCTYPE set and how closely the browser conforms to the standard and/or tries to "help" by guessing what you meant.<
The former in the fun days before XHTML, and the latter as a part of XHTML. What works is most likely going to be based partly on the DOCTYPE set and how closely the browser conforms to the standard and/or tries to "help" by guessing what you meant.<
Postet den
Firefox does not care about standards nor DOCTYPE at all, so it should work regardless doctype. However selected="selected" should be better option. If it does not work in Firefox, it should not work at any browser as well, which is most likely "not matching" any records.
In your case: crs("Cat_ID") = strProductCat, you can try cLng(crs("Cat_ID")) = cLng(strProductCat) or lcase(crs("Cat_ID")) = lcase(strProductCat)
I suggest to view source codes on browser via "View source" etc. to see what's going wrong there.<
In your case: crs("Cat_ID") = strProductCat, you can try cLng(crs("Cat_ID")) = cLng(strProductCat) or lcase(crs("Cat_ID")) = lcase(strProductCat)
I suggest to view source codes on browser via "View source" etc. to see what's going wrong there.<
Sist redigert av
Postet den
ok, so using selected="yes" works (in firefox)
is that universal? does the same thing also work in IE, Opera, etc? or do I need to add browser detection and have 3 sets of code?<
is that universal? does the same thing also work in IE, Opera, etc? or do I need to add browser detection and have 3 sets of code?<
-Stim
Email Member
Message Member
Post Moderation
Filopplasting
If you're having problems uploading, try choosing a smaller image.
Forhåndsvis post
Send Topic
Loading...