Do While Loop To Add Up ObjRS Values
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
ADVERTISEMENT
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 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 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
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
I was just wondering what the zero represented in the code:
objRS(0)
Is it the record position within the opened table?
View Replies
View Related
I have:
strSQL = "SELECT * FROM newarchive WHERE Program_Title LIKE '%" & program & "%' ORDER BY ID"
set objRS = objConn.Execute(strSQL)
Response.Write "There are " & objRS.RecordCount & " results."
I get -1 for the count on every search.
View Replies
View Related
I"m having trouble inserting into a table with a objRS can someone post a example of the formatting?
View Replies
View Related
objRS.recordount returns 0 even though there are records in the recordset or table
This problem occurs only when I upload asp file to server(windows server)
It is working correctly on local computer. I have used following code:
<%
objrs.open strsql,objconn,3,2
count1=objrs.recordcount
%>
Any suggestions?
View Replies
View Related
Dim objRS
objRS=server.createobject
after my sql statement is executed
lets say thers nothin to return.. no value
then with what do i compare objRS(0).Value?
is it NULL or 0
i tried but they aint workin
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
how to list a specific record's value on a one of many of these: <%=objRs("eventcaption")%>. I'll try to be as specific as possible but I am not sure if I know just how to describe it.Basically I have a calender and in each day I want to list an event caption such as "Wedding Day", specific to the events of any given day. Here is what I am looking at so far. Can I do something like <%=objRs("eventcaption.first")%>? 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
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