I have a problem which I'm struggling to fix.
I have a form with many checkboxes containing email addresses, the result of which is sent to another page.
This page will send out newsletters.
This is working at the moment, but what I would like to do is include their name.
From the form received I get the results ([email protected], [email protected] etc...)
I have managed to separate the results and put them into an array, but now I need to access the SQL db and find the names to the email address. This is where I'm struggling. Here is the code that I've tried to use:
name = request.form("list")
If name = "" Then
Response.redirect ("batchselect.asp")
End If
Dim your_name()
Dim mode
Dim mode_a
Dim i
mode=Request("list")
mode_a=split(mode,",")
For i=LBound(mode_a) to UBound(mode_a)
Next
i = i - 1
Redim PRESERVE your_name(i)
For t = 0 to i
Set conn = Server.CreateObject("ADODB.Connection")
conn.open connStr
strSQL = "SELECT name FROM emails WHERE emails = '" & mode_a(t) & "'"
Set rs = conn.Execute(strSQL)
your_name(t) = rs("name")
Next
If I try and run this I get this error:
Error Type: ADODB.Field (0x800A0BCD) Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
I know the problem is in the SQL Query 'mode_a(t)', because if take out the for... next and change this to mode_a(0) or mode_a(1) it works no problem.
I'm using MS SQL and classic asp
Thanks in advance