How To Get Variable = To Loop Statement
I need this variable = to a loop statement
Here is my str
form_bcc = Cstr(If Not objRS.EOF Then objRS.MoveFirst Do While Not objRS.EOF objRS.Fields("Email") Response.Write ";" objRS.MoveNext Loop End If)
And help on how to get this to work?
View Replies
ADVERTISEMENT
Is there something that prevents an if statement from being inside a loop. I keep gettting an error I put an if statement in my loop. Here's my code:
Do While Not categoryRS.EOF
response.write "<a href='away100.asp?playcategory=" & categoryRS("catname") &"&timer="& timer&"'><big><strong>"
if categoryRS("catname")=playcategory then
response.write "<font color='red'>" & categoryRS("catname") & "</font>"
else
response.write categoryRS("catname")
endif
response.write "</strong></big></a> <br>"
'Move to the next row in the lists table
categoryRS.MoveNext
Loop
View Replies
View Related
Is it possible to change a variable name? I need to store some information to be displayed to the users in a variable but I need to change the name of this variable. So what I need to do is read some info from the db, create a recordset and then read the first row of the recordset and store the result in a variable named Answer_1, read the next line and store the result in the variable Answer_2, is it possible?
I tried the following code:
Answer_"" & Counter & "" = "" & rsResult("Answer") & ""
Then I'll print it in the HTML part like this:
<% Response.Write "<INPUT TYPE=""text"" NAME=""QID_2"" VALUE=""" & Answer_2 & """>" %>
Is it possible to change the name of the varialb in a loop?
View Replies
View Related
When you submit the form you can see I am trying to get the each row of the form elements into a format such that I can build multiple insert statements. Here is what I am working with:
<%
Dim x
For x = 1 to Request.Form.Count
Response.Write Request.Form.Item(x)
Next
Would I use some type of Mod operator on the value of x to determine my line breaks?
View Replies
View Related
I need the the results from the loop, in the Response.Write objFile.Name & "<br>" bit to be declared as a variable and then I could:
Response.Redirect("/folder/url.asp?message="MESSAGE)
Does anyone know how I go about doing this? Or is there an alternative Code:
View Replies
View Related
I'm having a brain fart at the moment. Can someone tell me how to dynamically create variable names based on a loop counter?
for i = 1 to Num_Cart_Items
Item_Name & i = Request.Form("item_name" & i)
Item_Number & i = Request.Form("item_number" & i)
next
Desired result:
Item_Name1 = Test Product
Item_Number1 = 1234
Item_Name2 = Test Product 2
Item_Number2 = 2345
The problem is with the Item_Name & i..I used to know how to do this, but I can't remember or find any code that I did this with.
View Replies
View Related
I need to add the following variable into an SQL statement and not sure how to do it. strGCID needs to be inserted into the following statement:
SQL = "SELECT tblContacts.* FROM tblContacts INNER JOIN tblGC ON
tblContacts.GCID = tblGC.gcID WHERE (((tblContacts.GCID)=strGCID))"
i am just not sure of the proper syntax.
View Replies
View Related
sql = "SELECT * FROM & console &'news'"
I got that right now but i want the variable, console to be placed along with news so when it selects from the db it selects from gcnnews or whatever variable it's on. How do I do that?
View Replies
View Related
I have created a hyperlink in one page (all.asp) using this code:
<a href="cat.asp"><%= rsProds("category")%></a>
How do I create the sql statement in cat.asp to show only the categories listed by the link in all.asp?
I have this in cat.asp so far:
strQuery = "SELECT * FROM biz WHERE category = ' " & strVariable & " ' ORDER BY bizname ASC"
which shows nothing since the string variable had not been passed.
How do I get the hyperlink category name into cat.asp sql query as a variable?
View Replies
View Related
I'm trying to use a variable of retrieved via request from a form to select records.I'm pretty sure I am having a basic syntax error or something else basic. I retrieve the variable from a prevous form:
section_id = request("section_id")
I then retrieve some records and run the compare, if i use the actual value it works:
if rsArticles("tbl_articles.section_id") = "1" then
however if I substitute the variable section_id which equals 1 , it fails the compare and moves on to the else:
if rsArticles("tbl_articles.section_id") = section_id then
if I call the section_id value elsewhere it shows that it is set to 1, so I know it's being passed, <%=section_id%> returns 1 . What am I missing?
View Replies
View Related
i'm trying to change the following include statement :
<div id="contents">
<!-- #include file="includes/main_page.asp" -->
</div>
on an ASP page into something that receives the file name as a variable :
<div id="contents">
<!-- #include file="<%=fileToInclude%>" -->
</div>
however, this doesn't seem to work, as i get the following error message :
The include file '<%=fileToInclude%>' was not found.
it obviously is trying to find a file named <%=fileToInclude%> instead of seeing the variable my question is : is it possible to feed a variable into an include statement ?
if yes, how should i go about it ? if not, are there any alternatives ?
View Replies
View Related
I'm trying to calculate the total time using values from database I run a select statement to find the timein column in my database.
Now how do i assign the result to a variable so that it can be used? There is only going to be one result because i'm checking it against an autonumber field. that is used as time 1. Code:
View Replies
View Related
I have a page that calls itself using a form. The form has two select elements. In the sql statement I am attempting to match the values of the select element to populate a recordset.
The two fields in teh Access db are of type Text and of type Integer. What baffles me is that one sql statement works fine and the other returns nothing. I am having the issue matching on the bedrooms.
In the first statement I took out all other doo-doo and just matched bedrooms = request("bedrooms"). On the other one I used p.bedrooms but it keeps turning up empty. Code:
View Replies
View Related
I'm trying to pass a parameter from a for loop to the nested while loop
but only the first counter is passed. Here is the code:
View Replies
View Related
I have a recordset that I loop through all of the data within a table, within the same loop, I am trying to add another loops that pulls information from the first recordset to base the second recordset off of: Code:
View Replies
View Related
I'm turning my application into a "DLL". Everything worked fine untill I try to do a "While" in my asp code. Then I recieve an error like this:
"Object variable or With block variable not set"
My vb code look like this.....
View Replies
View Related
is there any way of passing a javascript variable over to a asp variable so
i can write it to my database.
View Replies
View Related
How do I convert an ASP variable to a Javascript variable?
View Replies
View Related
I have a case statment like
select case code
case "01"
ups_desc = "OPTION1."
case "02"
ups_desc = "OPTION2."
case "03"
ups_desc = "OPTION3"
case "07"
ups_desc = "OPTION4"
case "08"
ups_desc = "OPTION5 "
case "11"
ups_desc = "OPTION6"
case "12"
ups_desc = "OPTION7"
end select
I then have table called "users" which has the following
id
UserID
Code
now the trick
I want to loop through the recordset of the user tables and populate a drop down where the code from the case and the user table are the same.
Something like
do while rs("code") = code
<option> This then is populated based upon the loop(I have this code)</option>
loop
View Replies
View Related
I need to insert recordes into a db based upon a number returned in a form
Somerthing like
AddRecords = Request.Form("NumberOfRecords")
Count = 0
if Count < AddRecords Then
Do while Count.eof
SQL Code....
Count = Count + 1
Count.move next
Loop
End If
View Replies
View Related
i have 2 tables (A & B) with date records
now i loop table A and then table B, the output will be table A in the front
and table B in the back.how can i make the output show by date in both tables altogether?
do i need to combine tables before but the number of records is over 100K
which may spend a lot of processing power?
View Replies
View Related
on my classifieds site i would like to create a simple ads system. i currently have the ads site made but need some advice.
on my classifieds site i would like to display the ads down the left hand side.
however i dont want to over display ads.
if there is not many items listed i only want a small amount of adverts shown on the left hand side. however if there is lots listed
i would like quite a few adverts listed.
otherwise i would have a big list of adverts and only a small number of items listed making a big blank space on my page.
i am guessing this would have to be a loop or something.
the code i am using to show the text links is <%=adurl%>
View Replies
View Related
I am using a for loop in one of my asp page. Could someone let me know if I can do the for loop as follow:
[code]<% for i = 1 to 5 %>
my html code
my html code
my html code
<% Next i %>
instead of
[code]<%
for i = 1 to 5
Response.Write "<input name = 'id'"&i&" type='text' value = "&id& ">"
Next i
%>
View Replies
View Related
I am using ASP and need a DO LOOP to get some info back from the db. but the asp reads the first do loop but does not read the second one ......
View Replies
View Related
is there any function or statements that work the same as the 'break' statement in C++ language?
for example:
While Not rs.EOF
If rs("LoginID") = userId Then
break 'what shd i use for ASP???
Else
rs.movenext
View Replies
View Related
im writing some script to add records to my db. but if a value thats about to be added exists, then dont add that record.for example: if i want to add 7 records to my db with the values 1 - 7, but the db already has 3, 5 and 7, then it should only add 4 new records (1, 2, 4 and 6).
i have a record returning all records form my db, and an array with the values i want to add. i want to loop through my recordset of all existing entries, then for each loop, start another loop to see if the value exists, and if it doesnt , then add a new record.
View Replies
View Related
How to use the for loop or do while loop to create the age range from 10 -100 to let the user to select from the form object - list/menu by using asp? The coding below is just a concept. For example
Response.Write("<select name=""select"">")
for (a=0; a<101; a++)
(
Response.Write("<option value=""" & age & """>" & age & "</option>")
)
Response.Write("</select>")
View Replies
View Related
I'm trying to create a page where images are displayed based on an id in a sql table (basically its an unlit candle until a value in the id field exists). I'm not getting an error with my code below - but its not working right either. Code:
<% If rs("my_id")="2" Then Response.Write "<img src=""images/07.jpg"" width=""56"" height=""97"" alt="lit candle">"Else Response.Write "<img src=""images/UNLIT_07.jpg"" width=""56"" height=""97"" alt=""unlit candle"">" End If %> ...
View Replies
View Related
I have a SUB which has input variables. If I run it once its okay, but I need to include it in a for....next loop. Can this be done ?
for i=0 to 100
call mySub(arr(0,i))
next
sub mySub(var)
.....code
end sub
View Replies
View Related
I am getting this error:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]Numeric value out of range
(null)
/database/data_entry.asp, line 90
Line 90 is shown below...
// count the total records by iterating through the recordset
for (rsProducts_total=0; !rsProducts.EOF; rsProducts.MoveNext())
{ <---- Line 90
rsProducts_total++;
}
This is an access database, connected to via a DSN. Any help will be muchly appreciated! I'm stuck on this one.
View Replies
View Related
I'm using three loops on a page and would like to set the loops individually to start at either 0 or -1 based on a condition. As an example, I would want the loop to start at either -1 as shown or 0.
Dim r
For r = --1 to Session("TotalRowsF")
code...
Next
Or, based on the condition it could be
Dim r
For r = 0 to Session("TotalRowsF")
code...
Next
View Replies
View Related
I can display some text 5 times using a loop and i want to pass those printed
values to another page when i clicked send button.
View Replies
View Related
I'm trying to give the variable sStart a new name on each loo
EG
sStart1 = value1
sStart2 = value
however the following piece of code doesn't work
set oNodes=xml.selectNodes("/Project/Tasks/Task/Start"
for each oNode in oNode
sStart=oNode.tex
response.write("<BR>"
for i=0 to 10
response.Write(sStart(i)
nex
next
View Replies
View Related