We help IT Professionals succeed at work.

SQL statement

jsctechy
jsctechy asked
on
Medium Priority
172 Views
Last Modified: 2013-12-24
why am i getting an error on this page:
<html>
<head>
<title>Deleting Contact...</title>
</head>

<body>
<cfquery name = "DeleteContact" datasource = #application.dsn#>
DELETE *
FROM Contacts
WHERE ContactID = #url.ContactID#
</cfquery>

<cflocation url = "deletedContact.cfm?alphaindex=#url.alphaindex#">
</body>
</html>

The error says that incorrect syntax is near *.
Thanks
Comment
Watch Question

The DELETE statement in sql either does not need to specify the fields, it implicity deletes them all.

<cfquery name="DeleteContact" datasource="#application.dsn#">
  DELETE
  FROM Contacts
  WHERE ContactID = <cfqueryparam value="#URL.ContactID#" CFSQLType="CF_SQL_INTEGER" />
</cfquery>

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
jsctechyInfrastructure Team Lead

Author

Commented:
how can i do that after the click is done and the deletion is been done to route the user to this page:
deletecontact.cfm?
I'm not sure that I understand your question. It appears that to delete a person, a user would go to the page you've shown specifying an ID number in the URL, and then after the person has been deleted, they are redirected to the deletedContact.cfm page.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.