Attempting ASP link to Database

H

H8ids

Working on dynamically deleting a database entry. Below is the code I'm
running into an error with. There is a column in the database by the name of
"email".
Is it possible for the ASP code to define an ACCESS column as a Form?

<%
' Declaring variables
Dim email, con, data_source, sql_delete
email = Request.Form("email")
sql_delete = "delete email from users where email = '" & email & "'"
data_source = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source = " & _
Server.MapPath("mail.mdb")
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
con.Execute sql_delete
con.Close
Set con = Nothing
Response.Write "Your email address " & email & _
" was successfully deleted from our database."
%>
 
S

Sylvain Lafontaine

You cannot delete a column, only a whole row.

If you want to set the email column to blank, then try something like this:

Update users
Set email = Null
where email = '" & email & "'"

Of course, you replace Null with the empty string "", based on the
definition of the email column and the overall logic of your program.
However, under Access, Null is more often used than the empty string.

The above will also reset the values of all other users with the same
e-mail. This might be a concern if there where an error with the provided
email in the first place.

S. L.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top