Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

SQL statement

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
0
jsctechy
Asked:
jsctechy
  • 2
1 Solution
 
mkishlineCommented:
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>
0
 
jsctechyAuthor 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?
0
 
mkishlineCommented:
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.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now