Assigning Values In A While Loop
I don't know if this is possible, but I have a Do While Not rs.EOF loop that is pulling values from a SQL database and writes it to an html form. I'm trying to figure out how to tally the values as they are siphoned from the database -- I'm assuming I have to set a unique variable equal to that value as it goes through the loop, but I'm not certain how to pull it off. Code:
View Replies
ADVERTISEMENT
I know I can use
Dim Array1(item1,item2,item3)
Session("Array2") = Array1
To copy a local array to a session array. What syntax do I use to copy a local array to another local array (without using a loop to load each element)?
View Replies
View Related
I am reading about 200 records from dbf file in ASP code and inserting into a table. I fetch the records in a recordset and in the recordset loop I have to insert it into the SQL table.
How should I insert the values?
1) Should I use query in ASP page
2) Or call stored procedure (passing each record parameter) for inserting, 200 times in the loop
View Replies
View Related
I have an ASP page connected to an Access database table. Im wondering of an easy do while loop which will go through each of the records in a specific column and add them up.
Do While Not objRS.EOF
objRS.MoveNext
'Code to add the sum to TotalNumberValue using objRS("NumberValue") recordset
Loop
View Replies
View Related
I have an ASP page that has 2 List Boxes. The first List Box contains available items and the 2nd list box contains selected items. Code:
<select name="lstAvailable">
<option value=”1”>User 1</option>
<option value=”2”>User 2</option>
<option value=”3”>User 3</option>
</select>
<select name=”lstSelected”>
</select>
I have JavaScript that populates the lstSelected when items are clicked on from the lstAvailable list box.
When the user presses the Submit button, a 2nd ASP page actually does the insert. My problem is that I do not know how to retrieve the value from the 2nd list box (lstSelected) from the 2nd ASP page. I need to do an insert for each item in the selected list box.
I have tried using Request.Form(“lstSelected”) but that did not work. I also tried a For next loop but I could not get that to work either.
Can someone help me figure out how to loop through all values in the lstSelected list box from the 2nd ASP page?
View Replies
View Related
I am using a ASP.NET function that returns a table with columns and rows and data (in the cells) taken from my DB (using ado.NET). That function actually returns a set of HTML tags with values, Labels and input boxes. All of that is working fine but now (after the function build that form whith that table) I want the user to fill some of the input boxes located in the last column.
The problem is that i do not know how many input text boxes had been changed by the user (different rows) and i need to manage all the input data of those input boxes.
in VB.NET I can use a loop which goes for each and rvery control and take its text (or value) property.
How can I do that here ?
How can i chack each of the input boxes values using a loop (becuse that input boxes had been filled accourding to a database and in additional the user changed/Add values to some of them ?
for information, to fill the that table i am using a loop that filled the table rows and values accourding to the rows in the DataBase and names of those inputboxes called: "Amount_" & i the "i" is an index which represent the row in the database.
View Replies
View Related
How at the start of script can I dynamically loop through all Request.form variables and use them ? either name or the value, both is the ideal though.
example.
have a form:
2 textfields. named "text1" and "text2"
In asp I need to dynamically grab this data not knowing that this form had the textfields "text1" and "text2".
ideal print:
name "text1"
value of text 1
name "text2"
value of text2
View Replies
View Related
I am trying to pass a value into the text field on selecting the option in a drop down. The code works if the 'For' loop is not included. What should I do to make it work inside the loop? Code:
View Replies
View Related
How can I assign the result of a SQL-query to an ASP variable? This is what I have so far but it doesn't seem to work. Code:
dim strSQL
strSQL="select TestID FROM TestID_Description WHERE CL1='" &Request.Form("CL1")& "' AND CL2='" &Request.Form("CL2")& "'AND CL3='" &Request.Form("CL3")& "'AND CL4='" &Request.Form("CL4")& "'AND CL5='" &Request.Form("CL5")& "'AND CL6='" &Request.Form("CL6")& "'"
objRS("TC_Number")=objConn.execute(strSQL)
Maybe it's interesting to know that TC_Number is the primary key of the table.
View Replies
View Related
I have an ASP variable containing an XML object, i want to pass this object to a javascript object .... how can i do that?
one solution i know of is to write the xml in the page as an xml island and retriving this code using the document.getElementById....
is there another way where i can do that directly?
View Replies
View Related
I have a catalog of books which need to be categorized into different
groups. Some of the books can be listed under more than one category.
I'm creating a page where I can assign a group of books to a category
by checking the checkbox next to their name (say I've looped out 100
of them, and check some, and not others) then submitting the form for
processing, so that those titles where the checkbox is checked will
get the categoryid number assigned to them on a one-to-many table
I need to know how to read the checkbox value as it comes in if it is
selected or not, if it is, I'll send the isbn in one direction, and if
not, I won't send it at all.
So, how would I read this on the sheet that grabs the values?
View Replies
View Related
I'd like to have a variable that I assign a value to for an entire website. It's a variable that contains the DSN name for my ADODB Connection.
This variable value is necessary on every page on the website. Is it incorrect to assign a variable the value in global.asa so it just stays for the entire site?
View Replies
View Related
I am trying to assign an invoice number to orders that are made on my website so that i can combine multiple order numbers into one invoice number. Here is the code i am using to insert the invoice number into the orders table.
It works if there is only one order in the table but if you try and order again it multiplies the orders by the number of invoice rows for example if there was 3 invoice fields it would add the same order 3 times into the order table. Its got stuck in some sort of loop. Code:
View Replies
View Related
Well, it's quite simple, it's easily done in C, but in ASP (and VB in
general) i haven't been able to see it done...
function setvalues(var1, var2="a", var3="b")
if var2="a" then
response.write("Var2 wasn't defined")
end if
if var3="b" then
response.write("Var3 wasn't defined")
end if
end function
I hope it makes sense, and that someone has the solution to it...
View Replies
View Related
Is there a way I can assign a value of true or false to a VBScript variable? I have a function where I want to initiate a value of false: Would this work? 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 want to call a recordset so you can edit the details and then obviously pass the parameters onwards into the db. However, the user guide just says this:
To process other fields in the form, use the Form collection of the upload object the same way you would use the Form collection of the Request object. For example, if your form had a text element named UserName, your processing code would include: Code:
View Replies
View Related
i need to convert the escape values which are by mistake updated in DB.
example:
this is a sample text string
is updated in DB as
this%20is%20a%20sample%20text%20string
here %20 is the space.
like wise there are many entries for :,'
is there way that i can update all this in a update statement?
or use asp to to update the records?
View Replies
View Related
I have a variable SET which has the value Of 1, 2, 3, .., N.
SET=val1, val2, val3, val4, ..., valN
What is the commend or procedure to extract individual values, val1, val2, ...
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