SQL missing operator problem???

Results 1 to 2 of 2

Thread: SQL missing operator problem???

  1. #1
    Join Date
    Dec 1969

    Default SQL missing operator problem???

    I have the following code which loops through an array and sends an email to each person in the array. It worked before I put the sql in so whats wrong? I get an error message saying missing operator in line 22. Line 22 is the sql statement for the Users table.<BR><BR>Anyone got any ideas please???<BR><BR>&#060;%<BR>strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("databases/issuemanager.mdb")<BR>dim adoCn<BR>dim strSQL<BR>set adoCn = Server.CreateObject("ADODB.Connection")<BR>adoCn.O pen strConn<BR><BR><BR>&#039;Output Email values fomr recordset until end of recordset.<BR>Dim strName, strNumber, strVariable, strAssigned, arrayAssigned <BR>Dim i, j, intCounter<BR><BR>strAssigned = "Simon Goldsmith, Phil Ward, Rachel Edmonds"<BR>arrayAssigned = split(strAssigned, ", ")<BR>intCounter = UBOUND(arrayAssigned)<BR>For j = 0 to intCounter<BR><BR> strUsername = arrayAssigned(intCounter)<BR> Response.write strUserName<BR> dim adoRs<BR> set adoRs = Server.CreateObject("ADODB.Recordset")<BR> strSQL = "Select * From Users Where Name=" & strUserName<BR> adoCn.Execute strSQL<BR> strEmail = adoRs("Email")<BR> <BR>&#039;------------------------------------------------------------------------------------<BR> Dim objmail, strbody, strProject<BR> strbody = "&#060;html&#062;&#060;head&#062;&#060;/head&#062;&#060;body bgcolor=#FFFFFF&#062;&#060;font face=""verdana"" size=""2""&#062;&#060;b&#062;Email Array Test&#060;/b&#062;<BR>"<BR> strbody = strbody & "Just a test to see whether array works with recordset&#060;/body&#062;&#060;/html&#062;"<BR> Set objmail = Server.CreateObject("CDONTS.NewMail")<BR> objMail.From = "projectmanager@missionadvertising.com"<BR> objMail.To = strEmail<BR> objMail.Subject = "Email Array Test"<BR> objmail.BodyFormat = 0<BR> objmail.MailFormat = 0<BR> objmail.Body = strbody<BR> <BR> objmail.Send<BR> Set objMail = Nothing<BR>&#039;------------------------------------------------------------------------------------<BR>Next<BR><BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default Debug it

    strSQL = "Select * From Users Where Name=" & strUserName<BR>Response.Write strSQL<BR>adoCn.Execute strSQL<BR>strEmail = adoRs("Email")<BR><BR>Off hand though I would say you are missing your single quotes.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts