Delete From SQL Table Syntax

I am using a select command to get the bang on right record I want, however when it comes to adapting that select to delete that record i get an error.

Im guessing I have to change the syntax for a delete but am unsure on the correct command.

My Select is

SELECT TOP 1 * FROM table WHERE x = x ORDER BY date DESC

And the below will not work
DELETE TOP 1 FROM table WHERE x = x ORDER BY date DESC

Any ieads?

View Replies


ADVERTISEMENT

Delete Syntax Error

i have a field box in which the users enter their date in the dd/mm/yyyy format, when it gets inserted into the database it would be mm/dd/yyyy

the FormatMonthDate just changes the date to display mm/dd/yyyy

the values get inserted into the pther table but i cant seem to delete them Code:

View Replies View Related

Edit And Delete From A Table

I have a table which views fields from database to users. I have the edit and delete links in each row. My question is how do I get the id of the row in the url to use in the action page?

View Replies View Related

Sql CREATE TABLE Syntax Error

I'm trying to dynamicly create a table in an existing ACCESS database. Code:

View Replies View Related

How To Transfer Records From One Table Of A Database To Another Table In Another Data

I have aproblem to transfer a data from table x to table y based on id. Its mean when 2 table have same id all data table x must move to table y. I don't know which command need to use is it insert into or update?

<%
Dim conn
Dim rs
Dim MYSQL,MYSQL2

Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
Set cmd = Server.CreateObject("ADODB.Recordset")
conn.ConnectionString = "DSN=prmm;UID=administrator;pwd=sa"
conn.Open

startdate=request("tarikh1")
enddate=request("tarikh2")

MYSQL = "SELECT * FROM table_x where paymentdate between '" & tarikh1 & "' and '" & tarikh2 & "'"
rs.open MYSQL,conn ....

View Replies View Related

How To Open A Recordset For A Table Has Space In The Table NAME?

I am trying to display the content of a Table called

'Order Detail' directly from the database (e.g., Northwind.mdb). I have the following commands:

Set tableSet = Server.CreateObject("ADODB.Recordset")

tableSet.Open table_name, DB_name, adOpenForwardOnly, _
adLockOptimistic, adCmdTable

where, table_name = ''Order Detail" Or
table_name = 'Order Detail' Or different variations.

I always get error on the second command with the following message:
Syntax error in query. Incomplete query clause

which I believe because of space in the Table Name. How can I resolve this issue? (working with file or table name with space)?

View Replies View Related

Table Inside A Table Update To DB

I have a table with many txt boxes which i have inside a form with a submit button to an update page which adds all the details to a db. The problem is i have a another table inside the first e.g. table 2. i want to be able to update table2 by clicking a second submit button that would update it. Is it possible to have a form within a form or how can i do it??

Also i need to update the entire table in one go. For exampple if i have 3 records in table2 i want to be able to update them all by clicking the one update button. Code:

View Replies View Related

Copying From Table 1 Inserting In Table 2

I have the following code but this is inserting manually. I want to make a query from table 1 and automatically enter the records into table 2. What needs to be modified? Code:

View Replies View Related

Bookmarking A Position In A Table <table>

Have an app which dynamically creates table rows depending on records, these can be several hundred (don't ask). Hence a very long page at time. Each row includes a hyper link to a new page, and a link back to the original page.

Is there any method (maybe via js) where on leaving the second page l can redirect the browser to the table row the end user clicked on? Hence the bookmarking. Can do this via Visual Basic on the desktop app, but can't work it out on the web app.

View Replies View Related

How To Get Data From A Table Into A Table Form?

I have a table produced with names across the top and services down the left hand side with boxes for numbers for people who recieve services then the info is written into a table in an access db. That works fine and here is that code:

View Replies View Related

Best Method Of Updating Table From 2nd Table

I have two tables. Table A has 20,000 records, Table B has 2,000 records. Table A is what needs to be updated from the data in Table B. Only some fields will be updated and of course, only some records - both tables have the same field as a ClientID so matching up records should be easy.

Anyways, been a while since I have used ASP to work on things like this but would like to work through this one. I understand the process I believe, it is just how to make it go on to the next record once it has finished updating the first.

Basically, I was thinking of having it set up to reaad the top record from Table B, update applicable data in Table A. Delete that record in Table B. Move on to the next.

View Replies View Related

Record Set For Id From Table 1 To Table 2

Hello I have a page for registering users.

I am reciveing this error:

The following errors occured:
- An error occured. -2147217904 : No value given for one or more required parameters.

there are students and teachers. therefore I have 3 tables one for logins and one for staff and on for students.

I have a form designed to capeture the need information.

in the code I am runing an if and elseif statmetn to determin the tables. I then insert the userid and password into the login table.

then i enter the remaining information into ither the staff or student table. what i am trying to do is select the perimary number that is generated as the userid and passeword are enterd. and add this to the second table. Code:

View Replies View Related

FSO Delete

I have this code that deletes a file using FSO but it wont work Code:

View Replies View Related

ADD/DELETE In ASP

I am trying to delete all the records from one table and insert a few in the same table.
When I run the asp it gives me the error message

"Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Could not delete from specified tables."

Before opening the connection to the database, I tried setting the mode to 3 as follows:

Set Conn = Server.CreateObject("ADODB.Connection")
conn.Mode= 3

Then I open the connection. But it still gives me the same error.

View Replies View Related

Delete Value

How do you delete from the objRs when you choose the value to be deleted form a dropdown menu?

View Replies View Related

Delete

i would like to be able to delete a record from a database this is the code i have atm but it is not working:

if request.querystring("action") = "delete" then
strSQL = "DELETE * FROM DVDDescription WHERE DVDDesc_ID=" & request.querystring("DVDDesc_ID") & ";"
objRS.open strSQL,conn,1,2
'objRS.close

end if

Code:

View Replies View Related

SQL Delete Timeout

I'm getting an error from something that seems too easy to cause
trouble. Here's the scenario. User fills out a form. User saves. On
submit, an asp script attempts to save the data. it deletes all of
existing child records, and then re-inserts new child records.

Heres the chunk of code thats bombing out with a 'Microsoft OLE DB
Provider for SQL Server error '80040e31' ':

'delete all children for this Parent record
strSQL = "DELETE FROM qcspec_is_tasks WHERE parentID = " & nRecID
debugPrint strSQL
cn.Execute strSQL

The print statement yeilds the following, before the Execute statement
dies:

DELETE FROM qcspec_is_tasks WHERE parentID = 20

If I run the above in query analyzer, it executes instantly.

Incidentally, at this point in time, the table is tiny. Its only 50
rows or so, at the moment.

View Replies View Related

Delete Query

I have this query

strsql = "Delete FROM College_List WHERE
STDID = (Select ID from Students where StudentID='" & getstdid & "')"

i get this error

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

but i want to delete all the records in the child table that have the ID in the parent table which is students.

View Replies View Related

ASP And ASP.net Cookies - Delete It

During the development, I need to test cookies (ASP and ASP.net).

For the first time I test (First username), it writes the cookies into my computer using the First username, and when I want to test second time, using another user name (Second username), it wont't show up the login page, but instead it automatically let me access the protected page (using the first test username).

Question: I want to delete this cookies! How?

I have searched:

Temporary folder, and can't find it.
Document and settings (W2000 Professional), and can't find it as well.

View Replies View Related

'Email' Delete

The easiest way to describe my situation is by using the 'email' example. I retrieve my email messages and place a 'delete' checkbox by each message. I select the messages I want to delete and then click the delete button. They magically disappear.

I'm using ASP-->COM-->Stored Proc. I've envisioned creating a recordset to hand to the COM, then for each record fire the stored proc (although I'm unfamiliar with modifying a recordset before a form submit).

View Replies View Related

Delete In The Same Window

I have this code where I can check mark the items I want to delete and hit the submit key and it will delete the records, but the problem is that when I hit submit it opens another window for the same page and I can see that the records are the deleted, but the page where I checked marked the boxes to delete the records is still there and its still showing the records.

I dont want to open another window, I want all this process to happen in the same page and when I click on the delete button it should delete the records and the same page should refresh. Code:

View Replies View Related

Delete Record

I been working on this code for a long time, code doesn't work and It also doesn't show any error. All I am trying to do is delete record. I click on id number from first page that brings me to this page. Code:

View Replies View Related

Delete Files

Is it possible after i run my process i delete text files from server.
I run a process to read from text files after that i want to delete
these text files so that no one again run the process.I am using ASP.

View Replies View Related

SQL Delete And Inner Join

Basically I'm trying to combine an SQL inner join with a delete statement, like:Code:

var cnn = Server.CreateObject('ADODB.Connection');
cnn.Open(Application('cnn'));
cnn.Execute('delete * from editors_sections inner join editors on editors_sections.editor_id = editors.editor_id where editor_id='+intEditorId+' and editor.isSectionOne=0 or editor.isSectionTwo=0 or editor.isSectionThree=0');
cnn.Close();
But it gives me the following error:

Incorrect syntax near '*'.

Can this be done, and if so, can anyone see where I'm going wrong (I'm using JScript if that makes any difference?)

View Replies View Related

Delete Content

can someone help me. I'm writing an onlineshop in asp and for the shopping cart
i use an array. If someone wants to delete some articles from the cart, i have to
delete them from the array. How i delete only one article (on line) from the array.

View Replies View Related

How Do I Delete Record Using ID ?

I am trying to delete a chosen record out of my Access database using the ID field as the parameter. I can get the script to output the record so I know it has the record, it just won't delete! Code:

View Replies View Related

Delete Record

I'm simply trying to check if the categoryid is currently being used by any catalogue/product items.

Ok, I've created a mini site content management system and I'm stuck on this function that will ensure data integrity...

I'm trying to check if the categoryid I'm trying to delete has any related 'catalogue' items (products); and if so display a message 'Sorry, there are items currently listed under this category. Move the items before trying to delete'. Basically disallow the delete function if any catalogue items share the categoryid. That's it! Simple... right???

Code:

View Replies View Related

Delete File

How can I delete a file which is saved in a folder when the user checked on the checkbox of the file to be removed and click on the Delete button?

View Replies View Related

Automatically Delete

how do i automatically delete records on date submitted

View Replies View Related

Delete Function

if i want to delete from a record like this..
attached a pic. with the rubbish bin icon

<td ><a href="update_plan.asp?ty=D&ID=<%Response.Write rs("planid")%>"><img src="../images/delete.jpg" alt="Delete" border="0" width="20" height="20"></td>

i want to do a response.write so that it will know what is the pk to delete from? can anyone help me on this?after that how can i execute a delete sql statement?
like
<td ><a href="custorder_edit.asp?ID=<% response.write rs2("ExecNo")%>"><img src="../asp/jpeg/delete.jpg" alt="Delete" border="0" width="20" height="20" onclick="document.edit_custorder.action.value = 'delete_edit_orderdelivery'"></td>

View Replies View Related

Delete Categories

I am using MS Access & open 3 table, 1 for Product 1 for Genre, 1 more for Product_Genre (because one product maybe have many categories)

But when I have tried many ways to delete one of categories, also fail to do it.

What I want to do is : When delete a category,

1) it must delete the Product which is under the Category (to be delete)
2) at the same time it must also delete the records from table 'Product_Genre' which is related with the Category (to be deleted)Code:

View Replies View Related

Conformation For A Delete

i need the code that it give me a msg box for asking me if i am sure that i want to delete this item or not?

View Replies View Related

Could Not Delete From Specified Tables.

I am trying to delete records from a MS-Access DB table using the
following query:

strSQL=DELETE FROM MyTable WHERE
[id]=CInt(Request.QueryString("delete"))
con.Execute strSQL

When I run the app on my local IIS 5.1 server (on WinXP SP2), records
get deleted without any problems but when I upload the same file
(which has the above DELETE query) to the actual remote server, then
ASP generates the following error:

Could not delete from specified tables.

I have gone through numerous posts & articles to resolve the issue but
unfortunately the error still persists. The only apprehension that
comes to my mind is could permissions to the directory which houses
the MS-Access DB table be the cause of this error.

Actually in the remote server, the Access DB table resides in a
directory named "db" (without the quotes). When I view the permissions
that IUSR_MachineName has for this "db" directory (through the web
browser - the hosting service has given this option), then I find that
IUSR_MachineName has only the Read permission but when I try to set
this directory's Write & Modify permissions for IUSR_MachineName, then
I am not being allowed to do so. So could this be the cause of the
error?

View Replies View Related







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