I would suggest breaking my code as follows so that it becomes readable and understandable:
Dim execSql execSql = "insert into SALT (Email, Username, FirstName, LastName, ActivationCode)" execSql = execSql & " VALUES ('" execSql = execSql & Request.QueryString("payer_email") execSql = execSql & "', '" execSql = execSql & Request.QueryString("payer_email") execSql = execSql & "', '" execSql = execSql & Request.QueryString("first_name") execSql = execSql & "', '" execSql = execSql & Request.QueryString("last_name") execSql = execSql & "', '" execSql = execSql & Request.QueryString("hash") execSql = execSql & "')" Set rstSimple = cnnSimple.Execute(execSql)
while typing, I deleted the error quotes from your string. Now it becomes more obvious where they are if you get a new error. In addition, the coloring of the code makes it readable and easily recognizes an error (depending on which editor you use).
Edit SQL Injection and Security
As mentioned earlier, your code is very susceptible to SQL injection attacks. Even if an attack is not intended (e.g. drop your database), it will fail if someone called d'Amour (French) or in 't Huys (Dutch) crashes your page. To get around this, do not try to filter your code, but rewrite it with the SQL command and parameters. It is easy, your code simply becomes the following:
Set dbCommand = Server.CreateObject("ADODB.Command") Set dbCommand.ActiveConnection = cnnSimple dbCommand.CommandType = adCmdText dbCommand.CommandText = _ "INSERT INTO SALT (Email, Username, FirstName, LastName, ActivationCode) " + _ "VALUES (@email, @user, @firstname, @lastname, @code)" With dbCommand.Parameters .Add("email", adVarChar, adParamInput, , Request.QueryString("payer_email")) .Add("user", adVarChar, adParamInput, , Request.QueryString("payer_email")) .Add("firstname", adVarChar, adParamInput, , Request.QueryString("first_name")) .Add("lastname", adVarChar, adParamInput, , Request.QueryString("last_name")) .Add("code", adVarChar, adParamInput, , Request.QueryString("hash")) End With Set rstSimple = dbCommand.Execute()
Note: make sure to download and enable ADOVBS.INC , so you do not need to replace the adVarChar and adParamInput , etc. with their numerical equivalents.
For more information, see this answer by SO José Basilio , Google on “SQL Injection ASP” or “SQL Appropared Statement Classic ASP”, it should find you some hits.