navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

DIM in a DRW

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> DIM in a DRW
Page: [1]
 
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
DIM in a DRW - 8/17/2002 18:38:51   
Hi All.

OK..this works fine. iTest give the correct results.:

<!--#include file=" ../_fpclass/fpdbrgn1.inc" -->
<%
DIM iTest
iTest=FP_FieldVal(fp_rs," PromoterEmail" )
%>
<%=iTest%>
<!--#include file=" ../_fpclass/fpdbrgn2.inc" -->

This doesen' t. iTest is only the last record of many:

<!--#include file=" ../_fpclass/fpdbrgn1.inc" -->
<%
DIM iTest
iTest=FP_FieldVal(fp_rs," PromoterEmail" )
%>
<!--#include file=" ../_fpclass/fpdbrgn2.inc" -->
<%=iTest%>

Here' s the rub. I need to have iTest outside the DRW.

Any ideas. Is this a DRW quirk?


Thanks

< Message edited by hzarabet -- 8/16/2002 6:45:29 PM >


_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/17/2002 19:15:06   
Am I onto something with this?

I don' t know how to write iTest=RS(" MailList" ) properly.

<%
sQry=" SELECT * FROM SHL_Promoters WHERE SHL_Promoters.MailList = ' Y' "
Set RS = Conn.Execute(sQry)
set rs=nothing
Conn.Close
Set Conn=nothing

DIM iTest
iTest=RS(" MailList" )

%>

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
no_mac_jack

 

Posts: 295
From: Washington state, USA
Status: offline

 
RE: DIM in a DRW - 8/17/2002 19:18:52   
Oops! You slipped another post in there on me. I' m heading out the door, so I' ll have to look it over later. Sry!

Well, you have to realize that your little section of code is in the middle of a loop, so it will repeat for each record returned.

In your second piece of code, you' re updating iTest with each record, but you' re only writing it out *outside* the loop, so it will always equal the last value it was set to.

FYI - Those two FrontPage include lines are the beginning and end of the loop if that helps you to see why it' s doing that.

With that in mind, what exactly are you trying to do? Are you wanting to store all of the Promoter Emails in an array? Print out all of them? I' m not quite seeing what you' re going for.

Can you explain a little more? Thx!

~no_mac_jack

< Message edited by no_mac_jack -- 8/16/2002 7:20:06 PM >

(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/17/2002 19:39:47   
Hey NMJ :)

I have a CDONTS. I want to feed the " TO" section from a database. This is where I want to insert the iTest. That is the simplest way to put it. I do have a Query feeding the CDONTS already. The iTest is coming from a different query.

Does this help?

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: DIM in a DRW - 8/17/2002 20:36:58   
<% 
sQry=" SELECT * FROM SHL_Promoters WHERE SHL_Promoters.MailList = ' Y'  "  
Set RS = Conn.Execute(sQry) 
iTest=RS(" MailList" ) 
set rs=nothing 
Conn.Close 
Set Conn=nothing 
%>


It should work in both instances up the top, how are you testing its not the case?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/17/2002 22:47:25   
Spooky, in that example iTest is not carrying the variable through.

Spooky...to answer your question (I think), when <%=iTest%> is outside the DRW includes, ONLY the last record of the group appears. When <%=iTest%> is inside the includes, all the results properly appear. Here is a copy of the HTML. Maybe that would explain it clearer than I can.

< Message edited by hzarabet -- 8/16/2002 10:53:35 PM >


_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
no_mac_jack

 

Posts: 295
From: Washington state, USA
Status: offline

 
RE: DIM in a DRW - 8/18/2002 0:15:00   
So are you only expecting the first query to return one e-mail or several? I think that' s where I' m getting confused, but the example did help.

~no_mac_jack

(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: RE: DIM in a DRW - 8/18/2002 10:26:42   
I am sorry NMJ. I am trying to send a MASS MAILING to a select group of promoters on my PROMOTERS table. This mailing will include information from a SINGLE RECORD off of that PROMOTERS tables that is INNER JOINED with information from a table called P2P.

:)

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to no_mac_jack)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: DIM in a DRW - 8/18/2002 17:37:38   
This is the only way youll action multiple emails within the DRW.
Using itest outside of the DRW will only result in the last record being emailed

<!--#include file=" ../_fpclass/fpdbrgn1.inc" --> 
<% 
DIM iTest 
iTest=FP_FieldVal(fp_rs," PromoterEmail" ) 
%> 

[color=#FF0000] '  Email script goes here[/color]

<%=iTest%> 
<!--#include file=" ../_fpclass/fpdbrgn2.inc" --> 


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/18/2002 17:53:41   
That' s bad news.

I am pulling in the mass of emails using a different query than what is populating the text of the email.

Your example would mean (I believe) everytrhing working off of a single SQL statement.

Any options? There has to be a way to this.:)

Back to the drawing board.

Thanks

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/18/2002 18:36:23   
How about this? Is there any trick to placing an " include" inside a CDONTS?

MyCDONTSMail.To=" <!--#include file=" emails.asp" -->"

Call the email addresses in that way.

This isn' t working as is, but am going down a dead-end with this?

:)[:' (]:):):):)

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: DIM in a DRW - 8/18/2002 19:47:29   
Can you redefine what you want to do?
Im still not too sure what the outcome supposed to be.
Whatever it is, it can be done :-)

You have query #1 - what is it and what does it do?
For each record in query#1, what happens?


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/18/2002 19:59:19   
OK. Here we go...

1. I have a table called Promoters. Maybe 600 or so records. Of these 600 promoters, I want to send a mass email to about 300 of them.

2. I have a table called P2P. It contains the text of the message I want to mass mail. On top of that, I am ALSO pulling in information from the above mentioned Promoters table with regards to the individual promoter who is sponsoring the mass email. His email address, phone number, Name, etc. So the CDONTS will contain text from P2P and Promoter information from the Promoters table.

I have 2 SQL queries. One is to call the 300 emails from Promoters. The other is an INNER JOIN tying in the promoter info with the text of the message. I was trying to use a DIM with the results of the first query (calling the emails) and place the DIM inside the " To" portion of the CDONTS, attempting to plug in all 300 emails into the " To" . As you know, it didn' t work.

So the problem is, I can' t think of a way to do this without using 2 individual SQL queries. And if I use 2 individual SQL queries, I can' t place the DIM in the " To" portion of the CDONTS.

Now if all else fails, I can do it the " old fashioned" way and just cut & Paste the 300 emails into the BCC of my Email programs and do it that way instead of with a CDONTS. But, hey, this way is a challenge [:p]

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
no_mac_jack

 

Posts: 295
From: Washington state, USA
Status: offline

 
RE: DIM in a DRW - 8/18/2002 23:53:50   
Tell me if this is any closer...

You want to call the list of e-mail addresses from the SHL_Promoters table *once* and then use the DRW region to fill out one or more e-mails which would be sent to everyone from the first query. Am I on the right track?

If you' re pulling a bunch of addresses from the promoters table, do something like this to grab them all at once and stuff them into an array which we can use later...

<%
Dim connDB, strSQL, objRS

set connDB = Server.CreateObject(" ADODB.Connection" )
connDB.open ' ' put your connection information here

strSQL = " SELECT * FROM SHL_Promoters WHERE SHL_Promoters.MailList = ' Y' " 

set objRS = connDB.execute(strSQL)

Dim arrAddresses
If objRS.BOF AND objRS.EOF Then 
  Response.Write " Query #1 failed." 
  objRS.close
  set objRS = nothing
  connDB.close
  set connDB = nothing
  Response.End
Else
  arrAddresses = objRS.GetRows()
End If

objRS.close
set objRS = nothing
connDB.close
set connDB = nothing
%>


For more info on using GetRows() to store DB info in an array, see this ASPFAQ

Now you have those e-mail addresses in an array (actually, a two-dimensional array, to be exact). You can write them out like this...

Dim iCount
For iCount = 0 to UBound(arrAddresses)
  Response.Write arrAddresses(0,iCount)
Next


Granted, my syntax is likely completely out of whack, but it' s just meant to show that it can be done. I haven' t actually coded in ASP for over a year, so I' m a bit rusty. :)

Anyway, I' m hoping that this will at least be close to what you' re after. Let us know...

~no_mac_jack

BTW- You keep talking about wanting to put a Dim in the " To" field of the CDONTS mail, but the Dim statement is just a way of declaring variables.

(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/20/2002 23:38:44   
Between this thread and another thread I am running with Mojo, I am feeling like the biggest simpleton on the board!!! :) But I carry on!

OK, I sort of have your script running. Here is what is showing up:

297863861862856858859
Microsoft VBScript runtime error ' 800a0009'

Subscript out of range: ' 7'

/p2p/test3_copy(1).asp, line 46


That top bunch of digits are the Record ID numbers all squished together as one long number (297 863 861 862 856 858 859)

And I am not sure what Subscript out of range: ' 7' means.

So how do I translate this into my email addresses from those given rows? And when I figure that out does " &iCount&" go into the TO portion of the CDONTS?


Lastly:

PS: " BTW- You keep talking about wanting to put a Dim in the " To" field of the CDONTS mail, but the Dim statement is just a way of declaring variables."

I make up definitions and words as I go along


_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/21/2002 12:59:32   
So the questions are now...

1. How do I get the results from the MailList column to be pulled in instead of the index ID number column

2. Get rid of this error messafe:
Subscript out of range: ' 7'
The ' 7' relates to the number of results of the query. If I had 12 results then Subscript out of range: ' 12' shows up.

Thanks again all. I am close (I think)

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
no_mac_jack

 

Posts: 295
From: Washington state, USA
Status: offline

 
RE: DIM in a DRW - 8/21/2002 13:29:09   
Sorry about the numbers. I forgot to mention that you' ll want to change the initial query so that it only pulls out the field with the addresses in it rather than all of the fields (unless you need them). Then, I think you should get the addresses correctly.

As for the error, I think you just need to change my code a little bit for the loop...

Dim iCount
For iCount = 0 to UBound(arrAddresses[color=red],2[/color])
  Response.Write arrAddresses(0,iCount)
Next


I hope that does it! :)

~no_mac_jack

(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/21/2002 13:38:07   
Yes you did it! :)

So would

Dim iCount
For iCount = 0 to UBound(arrAddresses, 2)
Response.Write " MyCDONTSMail.To=" &arrAddresses(0,iCount)
Next

(or something similar because that didn' t work!) be my TO portion of my CDONTS?

Now I want to UNDERSTAND what you showed me! I will hit the WROX book again and try to figure out all the pieces.

Thanks again NMJ!!!!

< Message edited by hzarabet -- 8/20/2002 2:03:01 PM >


_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
no_mac_jack

 

Posts: 295
From: Washington state, USA
Status: offline

 
RE: DIM in a DRW - 8/21/2002 17:08:56   
Yay! :)

Now, to get it to set those as the " To" for your CDONTS mail, try the code below. It doesn' t seem very efficient, but I don' t think CDONTS lets you do anything like the AddRecipient in ASPMail. Give it a shot...

Dim iCount, strTo
For iCount = 0 to UBound(arrAddresses,2)
  strTo = strTo & arrAddresses(0,iCount) & " ;" 
Next

MyCDONTSMail.To = strTo


Now, if you wanted, I would guess that you could use your address as the " To" and then do

MyCDONTSMail.Bcc = strTo

so that they can' t see everyone else' s addresses when you send it. Anyway, that should work. If you want to learn why the GetRows part worked, I would go to that ASP FAQ that I linked to a couple of posts back. It also has a link to Charles Carrol' s page about GetRows and how it' s more efficient than looping through the recordset.

That UBound code on the loop tells it to stop the loop once the counter has reached the total number of addresses in the array. The code I left out tells it which dimension of the array to count. Probably gibberish, but with that Wrox book and the link I gave you, it will hopefully become a little more clear.

Hope that works! :)

~no_mac_jack

(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/23/2002 16:16:22   
Works great NMJ!!

Thank you again.

Do I have this straight?....

GetRows() is sort of like a giant claw that holds a group of records at one time....

The 2 in " For iCount = 0 to UBound(arrAddresses, 2)" signifies we are counting until the last ROW. If that were a 1 instead it would count until the last COLUMN...

Once again...bless you all for your patience with a comparative simpleton [:p]

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
no_mac_jack

 

Posts: 295
From: Washington state, USA
Status: offline

 
RE: DIM in a DRW - 8/24/2002 16:49:46   
Yup...I think you' ve got it down.

GetRows is like dumping the whole truckload of topsoil so the truck can go and do other things while you work with the topsoil rather than taking the soil out shovel by shovel. :) I just sort of made that up, but it' s really quite similar to what' s happening with GetRows.

And like you said with the UBound, if you change the 2 to a 1, it will repeat until the last *column*. You can nest two loops (one that repeats for each row and one that repeats for each column) like they did in that ASPFAQ to display everything in the returned set of data.

See you around...you done good!

~no_mac_jack

(in reply to hzarabet)
hzarabet

 

Posts: 1539
From: New Milford CT USA
Status: offline

 
RE: DIM in a DRW - 8/24/2002 16:57:08   
Spooky...you should give out Gold Stars!!!!

Thanks again NMJ for you patience!

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to hzarabet)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> DIM in a DRW
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts