Deleting RS Records Using Loop Iteration

Can I loop through a recordset and with each record, see if the value of a field is higher than 5. If it higher than 5, just delete that record, not the whole record set and continue the loop.

I am accustomed to using a sql statement to selecting an entire recordset based on similar criteria and deleting the whole recordset in one swoop, but not this time. Code:

View Replies


ADVERTISEMENT

Deleting Item Within A Loop

This is for my admin section. I have an item called header, which I am displaying through a loop and I want to give my user the option to delete any Header if they wish so. But since i'm calling the Headers through the Loop, I am unable to figure who do i delete them. Code:

View Replies View Related

Deleting Records

I am using ASP with SQL for my database.The problem I have is that even after I have ordered certain items from the shopping cart table on the webpage, I cannot remove them -
that is the entire list shows up the next time the table is opened.

is there any way I can delete the items once ordered so as to not let them show in my table?

View Replies View Related

Deleting Records

I am not sure if this is the right place to ask. but... I need to delete records where two fields in the same record are equal. I am not sure how to go about this.will this work?

strQ ="DELETE FROM Request_Notify WHERE Field1 = Field2"

View Replies View Related

Deleting Records

I was wondering the correct way to delete records from two different tables using inner join

Ex.{

DELETE tblPunchlines.Punchline, tblCast.LastName, tblCast.FirstName
FROM tblCast INNER JOIN tblPunchlines
ON tblCast.EmployeeID = tblPunchlines.EmployeeID
WHERE tblCast.EmployeeID = 3
AND tblPunchlines.EmployeeID = 3

}

Can anyone show me the correct way to do this

View Replies View Related

Problem With Deleting Db Records

I have a link on my page for each db record:

<a href="<%= strFileName %>?sc=delete&strArticleID=<%= recordset_obj("article_id") %>">Remove</a>

when i click the link, it goes to the correct "case" and will run through my deleteRecord subroutine. I checked it with output at the very beginning and end of the delete routine.

my problem is that nothing happens and i want the record to be deleted.

here is the delete routine: Code:

View Replies View Related

Trouble Deleting Records Via SQL

I have this list of records (from an Access DB) and would like to use check boxes to delete 1 or many records. I think there is something wrong with the SQL though, cause the records are not deleting when the form is submited. Code:

View Replies View Related

Deleting Records In A One-to-one Relationship

I am trying to get my code to delete a related record in a one-to-one relationship. The code I am trying is as follows:

mySQL = "DELETE FROM tblPurchaseOrderLine WHERE ((tblPurchaseOrderLine.lngPurchaseOrderLineID)="& PurchaseID &");"

myRS.Open mySQL, objConn, 1, 3

However, tblPurchaseOrderLine is related to tblAccessoryPackOrderLine of lngPurchaseOrderLineID. Do i need to reference both table in the statement?

View Replies View Related

Deleting And Then Re-adding Records

I may have made a typo somewhere. I am trying to delete collections from RelProdCollection Table that has a certain record with Product ID number of __ and then readd them based on the user's choices on the edit form. Code:

View Replies View Related

Deleting Records From A Database

If I have an access database with the fields Title, Artist, Description, DiscNo, TrackNo, Price and ID(Autonumber)

What would be a single-page script to remove only records where DiscNo= string entered into a text field in a form?

Example: I enter into the text field "SC8200" which relates to 18 records in the database. I click submit and all 18 records are deleted. Code:

View Replies View Related

Deleting Multiple Records In A Database

I get this message when trying to delete:

The column prefix 'username' does not match with a table name or alias name used in the query. I am not sure what this error is. I checked all over the place for the problem.

View Replies View Related

Adding, Deleting Records Using Global.asa

Can I do the following things in the global.asa file?

When sessions starts:

Add a record into my database

When session ends:

delete it where rs("sessionid") = Session.SessionID...

?

I'm pretty sure I can, but...I've heard not ALL things can be done in global.asa...

Do I create an object, and a connection? How would I do it? Since I want a database in MY database, not in memory like I've seen...

View Replies View Related

Trouble Editing, Updating, And Deleting Records

I am having trouble with the edit, update and deleting of records. I got the codes from a user in a different forum. Now I can't find ant help from that forum. Here is a link to a zip file with the pages and database in it.

bkdphoto.com/problem.zip

Simply open the listings.asp page then click on one of the Edit or Delete labels. I am getting the following message when I do:

Error Type:

Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/Tests/New Folder2/delete.asp, line 7

View Replies View Related

Error In Deleting,updating And Adding Records Using Asp!

I got an asp page that supposed to add,delete records from access 2000 mdb file. It loads all the records but when i try to delete or update i get these errrors. Code:

View Replies View Related

Loop Twice Through Records

I have what may be a simple question, how do I loop through a set of records twice? Here's a snapshot of what I have.

x = 0
do while rs.EOF = False
dim i
i = x
%>
<input type=text name="FirstName<%=i%> " value="<%=rs("Child_First")%>">

'I'd like to be able to have these input fields posted twice for each record.
<%
x = x +1
rs.movenext
loop
>

View Replies View Related

Loop Through List And Add Records

I have a list in a form where allows multiple selections

<select name="writerID" size="4" multiple >
<option value="no" selected> ---- writer ---- </option>
<%
do until RS.eof %>
<option> <%=RS(0)%> </option>
<%
RS.movenext
loop
%>
</select>
How do I make the loop in the add section where I have to retreive the records and add the selections?:

For ??????
RS.AddNew
RS("writerID") = request.form("writerID")
RS.Update
next

View Replies View Related

Loop + Adding Records

I have loop displaying certain records depending on an id number in my sql database. What i need to do using asp is total all the numbers in one of the fields and display that as a response.write.

View Replies View Related

Inserting Records Using A Loop

I want to insert records into a database using a loop. I've got a number of input fields named 1-50. I want to request each textfield and insert the data into a database table.

Whats the best way of doing this? I've tried a While... Wend loop but the loop seems to carry on.

View Replies View Related

For Next Loop Issue With Empty Records

I am having an issue with a For Next Statement...

I have a query that is looking up Company ID's where Specific ID exists... across multiple Access DB's

Data is return ok, but if a specific ID does not exists a DB, the query loops the last Result in the NEXT statement for subsequents columns...

My question how do i get the FOR NEXT Statement to look at NULLS and return ZERO instead of loops the last results...

View Replies View Related

Loop For Displaying Multiple Records From An SQL Query?

I have an ASP page where I want to display the 3 most recent records within a database using a SQL query. The problem is that my page which output the results is only showing the first most recent record and not the two past ones aswell.

Am I right in thinking that might be related to the 'loop' function? I know that my SQL code is fine as I have previewed the results from the code and they are correct. Code:

View Replies View Related

ADO Record Object - Test For Last Iteration (VBScript)

I have a record object (for instance, named record). I record.MoveFirst, then I set up a simple little loop:

For Each ofield in record.Fields
...
Next

Within my loop, I want to test to see if it is the last iteration. That is, with a simple If...Then, I want to be able to complete something the last time through.

Is this possible, either with some sort of record.EOF type property, or some sort of record.Count type property (and then using a simple counter during iteration to count down until the last one)?

I'd like to try to be at least a little elegant... I understand its possible to iterate through the whole record twice, the first time to count, but that would obviously be a poor choice if any other method is available.

View Replies View Related

Parameter Not Passed From For Loop To While Loop

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

Nesting One Loop Within Another, Using 1st Loop As Criteria For 2nd

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

Systematic Updating Of Records Depending On Amount Of Records In Another Table

The problem concerns 2 tables, cart_products and cart_shoppingcart.

Cart_products contains all the product data (eg, prices, product's key name, etc), but most importantly, it contains the quantity of stock (prod_quantity) for each item.

cart_shoppingcart contains all of the user's items in their shoppingcart, including those that are part of an (customer) order; these have the order_number to differentiate from those that aren't in any order (their Order_number is 'no_order', the others have the order number).

Now, what I want to do is this:

For every item in the order (ie, every entry in cart_shoppingcart that matches the username and order number), take the quantity (x) the customer is ordering, then take the quantity of stock remaining (y), then subtract x from y to create the new stock level (z) and update the appropriate record in cart_products with z (all this with SQl preferably).

I was thinking of using a Do while loop, but realised that it wouldn't work as I'd have to use several SQL statements and then I'd run into a problem the minute ASP reads "objrec.movenext".

View Replies View Related

Pulling Records From End Of A Database Or Inserting New Records To The Beginning

I'm trying to pull the last 5 records from my database.

<% j=5
rs.MoveLast
While ((j>0) AND (NOT rs_article.BOF))%>
''Execute HTML and data insertion here

<%rs_article.MovePrevious
j=j-1
Wend%>

Everytime I attempt to run this code, I recieve an HTTP 500- Internal Server Error. It tells me no more than that. I know that my connection settings are OK because when I move forward through the database (first five records), the code executes without error. And yes, my Cursor type is Dynamic.

Alternatively, I would also like to know how to add new recordset to the beginning of a database rather than the end.

View Replies View Related

Deleting

This code works fine, it deletes the record that already exist in the database and displays a message to the user the record has being deleted.... but it also it has a problem, if you enter a record to delete from the database and this record does not exist it displays the message that the record has being deleted, while instead it should display an error that this record does not exist in the database.

Code: ...

View Replies View Related

A Little Like Hotmail Deleting......

Ive run into a little trouble. I am sure all of you have used hotmail. Well you know when you select all items to delete, i would like to do something like that, however not delete, but update a field from no to yes.

I would like to add checkboxes to an asp table. So if the user selects say three items they then click on a button, say marked and for each item, it will go to the table and find each record in turn and update the corresponding field from a no to a yes.

Updating is no problem. The problem is, how do i add checkboxes to corresponding asp table. So that particular checkbox corresponds to that particular record. I don't know how to link them together.

Can someone help me out please?

View Replies View Related

Deleting A Page

I have a form that contains many pages. If someone clicks on delete, the application takes the user back to page 1 instead back on page in the breadcrumb trail. It is fine when the user is on page 2 but they could be on page 10 and click delete and then they are back to page one. I want to have the application go back on page at a time each time they click on delete. Here is what I have for code:

If LEN(page & " ")=0 Then
page = 1
End If
page = CInt(page)
If i = page Then
response.write "<font color=""#CC0000""><strong>[page " & cstr(i) & "]</strong></font> "

View Replies View Related

Deleting Folder

I have a script which allows a user to upload and delete files from the
server.Is it possible (and if so how) to do a check to see if the folder is empty
(ie if the last file in a particular folder is deleted by a user) and if it
is empty, delete the folder?

View Replies View Related

Deleting Record

I'm having trouble creating a one record recordset then deleting it. I've never done this before. The code below returns: "Type mismatch: objRS".

Code:

View Replies View Related

Deleting A File

On my webpage users can upload files and also delete those files. Everything seems to work, but when they upload a file that contains spaces, I am having problems getting the file deleted, for example: "This is my file.txt"

Is there a way I can delete this file. I have tried to take out the spaces, but the file still doesn't delete:
<%=Replace(Request("MyFile")," ","+")%>

View Replies View Related

Error In Deleting

this is my code but when i delete all the record there is error dispalyed ?

elseif (strType = "Delete") then
strSQLDelete= " Delete From events where id = " + ID
conn.execute strSQLDelete
response.redirect "eventform.asp"

View Replies View Related

Deleting Cookies

I am using cookies to store the user name and login state on the site. I am having some problems logging people out.

Firstly wanted to make the cookie values null but having some trouble with that

Response.Cookies("Login")("UserGood") = ""
Response.Cookies("Login")("Usercode") = ""

doesn't appear to do anything?

What would be really cool would be to delete to cookie in the logout script, can that be done from ASP?????

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved