Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Re global Message


Message #1 by "John Gonsalves" <j.gonsalves@n...> on Mon, 3 Mar 2003 10:50:22
Sorry about the first message I lost the first half of it when I cut and 
pasted it and did not realise the top half was missing.

I have created a query(Customers email addresses)inside my Access 
database that returns the email addresses of my customers from the 
Customers table. what I want to do is to send a global message to all 
those addresses. I have got the link to the database  

@ Language=VBScript %>
: <% Response.Buffer = True %>
: <!--#include file="connect.inc"-->
:
:
: <%
: On Error resume Next
: Dim objConn
: Dim myDSN
: myDSN="emotive"
: set objConn=Server.CreateObject("adodb.connection")
: objConn.open myDSN
: %>
:
: what I need to know is how to reteive my email addresses from my query?
:
: do I need an array?

Thank you
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 4 Mar 2003 13:16:09 +1100
<%
' Open connection code goes here
' Then add the following stuff
Set objCommand = Server.CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConn
With objCommand
    ' I would change the name of your query to *not* have spaces
    .CommandText = "[Customers email addresses]"
    .CommandType = adCmdStoredProc
    ' Do you have any parameters for the query?
    ' If so, you need to append them here
End With

Set objRS = objCommand.Execute
If not objRS.EOF then
    arrResults = objRS.GetRows
End If

Call objDispose(objRS, True, True)
Call objDispose(objCommand, False, True)
Call objDispose(objConn, True, True)

Sub objDispose( _
    ByRef objToDispose, _
    ByVal blnClose, _
    ByVal blnNothing _
    )

    If blnClose then
        objToDispose.Close
    End If

    If blnNothing thne
        Set objToDipose = Nothing
    End If

End Sub
%>

Now you have a 2 dimensional array (arrResults) then contains the results of
your query. Loop through this array, and do what you will with the results.

<%
If isArray(arrResults) then
    ' We have some records

    For i = 0 to UBound(arrResults, 2)

    Next

Else
    ' no records
End If

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "John Gonsalves" <j.gonsalves@n...>
To: "Access ASP" <access_asp@p...>
Sent: Monday, March 03, 2003 10:50 AM
Subject: [access_asp] Re global Message


: Sorry about the first message I lost the first half of it when I cut and
: pasted it and did not realise the top half was missing.
:
: I have created a query(Customers email addresses)inside my Access
: database that returns the email addresses of my customers from the
: Customers table. what I want to do is to send a global message to all
: those addresses. I have got the link to the database
:
: @ Language=VBScript %>
: : <% Response.Buffer = True %>
: : <!--#include file="connect.inc"-->
: :
: :
: : <%
: : On Error resume Next
: : Dim objConn
: : Dim myDSN
: : myDSN="emotive"
: : set objConn=Server.CreateObject("adodb.connection")
: : objConn.open myDSN
: : %>
: :
: : what I need to know is how to reteive my email addresses from my query?
: :
: : do I need an array?
:
: Thank you


  Return to Index