Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - Help me ! 2 table , 1 mail...
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Help me ! 2 table , 1 mail...

 Post Reply Post Reply
Author
BlueMask View Drop Down
Newbie
Newbie
Avatar

Joined: 27 April 2003
Location: Turkey
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote BlueMask Quote  Post ReplyReply Direct Link To This Post Topic: Help me ! 2 table , 1 mail...
    Posted: 23 June 2005 at 10:22am
Hi guys, i need your help! I tray to connect 2 tables. Then, when i take data, send mail.
 
<%
Response.Buffer = True
Dim strBody
Dim Konu
Dim Derece
Dim Mesaj
Dim objCDOMail
Dim strMyEmailAddress   
Dim strReturnEmailAddress 
Dim adoCon    
Dim Rs1
Dim strSQL1 
Dim Rs2
Dim strSQL2 
Dim SubeID
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("TestDB.mdb")

Set Rs1= Server.CreateObject("ADODB.Recordset")
strSQL1 = "SELECT * From Bireysel"
Rs1.Open strSQL1, adoCon
SubeID = Rs1("SubeID")
Set Rs2= Server.CreateObject("ADODB.Recordset")
strSQL2 = "SELECT * From Musteri where SubeID2 = '" & SubeID & "'"
Rs2.Open strSQL2, adoCon

Konu = Request.Form("Konu")
Derece = Request.Form("Derece")
Mesaj = Request.Form("Mesaj")
strMyEmailAddress = "ben@omertokus.com"
DO WHILE NOT Rs1.EOF
strBody = "Sayżn " & Rs1("Ad") & "," & "<br><br>"
strBody = strBody & Mesaj & "<br><br>"
strBody = strBody & Rs1("SubeID")
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = strMyEmailAddress
objCDOMail.To = Rs1("Mail")
objCDOMail.BodyFormat = 0
objCDOMail.MailFormat = 0
objCDOMail.Subject = Konu
objCDOMail.Body = strBody
objCDOMail.Importance = Derece
objCDOMail.Send
Rs1.MoveNext
Loop
Set objCDOMail = Nothing
Rs1.Close
Set Rs1 = Nothing
Rs2.Close
Set Rs2 = Nothing
adoCon.Close
Set adoCon = Nothing
%>


Edited by BlueMask - 23 June 2005 at 10:26am
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3938
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 23 June 2005 at 12:20pm
what doesn't work?

Lead me not into temptation... I know the short cut, follow me.
Back to Top
BlueMask View Drop Down
Newbie
Newbie
Avatar

Joined: 27 April 2003
Location: Turkey
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote BlueMask Quote  Post ReplyReply Direct Link To This Post Posted: 23 June 2005 at 1:01pm
Originally posted by dpyers dpyers wrote:

what doesn't work?
Yes, doesn't work!
i need to query in 2 table. Some data is the same. For example , we have to table ; x and y
 
in the x table some id = 1 and have mail address
in the y table some id = 1
 
i want to find them, and send mail automoticly.
 
can u help me ?
Back to Top
wingking View Drop Down
Groupie
Groupie
Avatar

Joined: 09 January 2004
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote wingking Quote  Post ReplyReply Direct Link To This Post Posted: 06 July 2005 at 4:07pm
Try This
 
<%
Response.Buffer = True
Dim strBody
Dim Konu
Dim Derece
Dim Mesaj
Dim objCDOMail
Dim strMyEmailAddress   
Dim strReturnEmailAddress 
Dim adoCon    
Dim Rs1
Dim strSQL1 
Dim Rs2
Dim strSQL2 
Dim SubeID
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("TestDB.mdb")

Set Rs1= Server.CreateObject("ADODB.Recordset")
strSQL1 = "SELECT * From Bireysel"
Rs1.Open strSQL1, adoCon
SubeID = Rs1("SubeID")
Set Rs2= Server.CreateObject("ADODB.Recordset")
strSQL2 = "SELECT * From Musteri where SubeID2 = '" & SubeID & "'"
Rs2.Open strSQL2, adoCon

Konu = Request.Form("Konu")
Derece = Request.Form("Derece")
Mesaj = Request.Form("Mesaj")
strMyEmailAddress = "ben@omertokus.com"
DO WHILE NOT Rs1.EOF
strBody = "Sayżn " & Rs1("Ad") & "," & "<br><br>"
strBody = strBody & Mesaj & "<br><br>"
strBody = strBody & Rs1("SubeID")
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = strMyEmailAddress
objCDOMail.To = SubeID
objCDOMail.BodyFormat = 0
objCDOMail.MailFormat = 0
objCDOMail.Subject = Konu
objCDOMail.Body = strBody
objCDOMail.Importance = Derece
objCDOMail.Send
Rs1.MoveNext
Loop
Set objCDOMail = Nothing
Rs1.Close
Set Rs1 = Nothing
Rs2.Close
Set Rs2 = Nothing
adoCon.Close
Set adoCon = Nothing
%>
 
assuming that SubeID = Rs1("SubeID") is an email address or else it won't work.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.