0

I have a simple ASP page that should delete or insert a row based on passed-in variables. I have similar files that work fine, but this one does not work... even though there are no errors and the response.write checks work fine. I even tried using literal values with no luck. Any ideas? Here is the code:

<%  
dim tid
dim email
dim joinOrUnjoin
tid = UCase(Request.Form("thisID"))
email = UCase(Request.Form("email"))
joinOrUnjoin = UCase(Request.Form("joinOrUnjoin"))

dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=SQLOLEDB;Server=*********;Database=Reports;User Id=**********;Password=***********;"
objConn.mode = 3
objConn.Open

if LCase(joinOrUnjoin) = "join" then

    strSQL = "INSERT INTO SSOcomEmailDistribution (ID, Email) VALUES ('" & id & "', '" & email & "')"
    Response.write "Join"
else

    strSQL = "DELETE From SSOcomEmailDistribution WHERE ID='" & id & "' AND Email='" & email & "'"
    Response.write "Unjoin " & id & " " & email
end if

objConn.Execute(strSQL)
objConn.Close()

Response.write " Done"
%>

1 Answer 1

2

You are using a variable named "tid" like this:

tid = UCase(Request.Form("thisID"))

but then, you use something else named "id" in your SQL string, like this:

strSQL = "INSERT INTO SSOcomEmailDistribution (ID, Email) VALUES ('" & id & "', '" & email & "')"

maybe just a typo, maybe something else is missing?

Sign up to request clarification or add additional context in comments.

1 Comment

And it's a good idea to use Option Explicit to pinpoint this sort of mistake

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.