Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL and ASP HELP!
    primarykey
    data
    text
    <p>I've been working on this script for the last week or so and i'm having major problems trying to understand why it's not working right.</p> <p>I've got some checkboxes link to email address and all i need is for the corresponding username to go with that email. This script is for users that have registered for different newsletters.</p> <p>Here is my coding</p> <pre><code>Set conn = Server.CreateObject("ADODB.Connection") conn.open connStr emails = Request("emaillist") emails = Replace( emails, "'", "''" ) emails = Replace( emails, ", ", "','" ) strSQL = "SELECT name, email FROM emails WHERE email IN ('" &amp; emails &amp; "')" Set rs = conn.Execute(strSQL) namesAndEmails = rs.GetRows() rs.close for lnRowCounter = 0 To Ubound(namesAndEmails,2) For lnColumnCounter = 0 To Ubound(namesAndEmails,1) Response.Write namesAndEmails(lnColumnCounter, lnRowCounter) Response.write "&lt;/P&gt;" Next Next </code></pre> <p>This is part of the whole script, i've changed it around a bit and included the for...next for debugging.</p> <p>Now for the problem, as shown in the SELECT statement 'name, email', the result completely ignores the email and give me the names only.</p> <p>I've tried the SQL statement direct and it works perfect showing both name and email together but not in my ASP page. I even tried putting a * in it's place.</p> <pre><code>strSQL = "SELECT * FROM emails WHERE email IN ('" &amp; emails &amp; "')" </code></pre> <p>Will return the users id, name, and a few other item's from the DB but not the name and emails together, why?????</p> <p>It's asp with a SQL Server database</p> <p>Regards</p> <p>Rick</p> <h1>Test Results</h1> <p>The values from strSQL when it's set as this: </p> <pre><code>SELECT name, email FROM emails WHERE email IN ('test@test.com','test1@test1.com') </code></pre> <p>This in SQL will give me the following answer </p> <pre><code>name | email jo | test@test.com fred | test1@test1.com </code></pre> <p>In asp the answer will be </p> <pre><code>test@test.com test1@test1.com </code></pre> <p>I can't figure out why in SQL it will show the name and email but in ASP it will only show the email and NOT the name.</p> <p>I've even tried </p> <pre><code>strSQL = "SELECT * FROM emails WHERE email IN ('test@test.com','test1@test1.com') </code></pre> <p>and this will produce in ASP all the results EXCEPT name!!!!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload