Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email the results of search using CDONTS(can't get results into string

Status
Not open for further replies.

gavray

Programmer
Jul 17, 2000
65
GB
hi,

Hi,

I'm trying to take the values of a search which have been called from the database,
by someones search. Then email the results to someone using CDONTS.

I don't know how to get those response.written values and put them into the email string.

the problem lies with the sub procedure email()

I'm using

<%Request(&quot;Company&quot;)=&quot;Company&quot;%> 'this is the problem area'
<%Request(&quot;Jobtitle&quot;)=&quot;Jobtitle&quot;%>
<%Request(&quot;region&quot;)=&quot;region&quot;%>
<%Request(&quot;industry&quot;)=&quot;industry&quot;%>


I'd be gratefull for some help

this is the full code.

<%@ Language=VBScript %>
<%
Status = Request(&quot;Status&quot;)

If Status =&quot;Search&quot; Then

Search

Else If Status=&quot;Email&quot; Then

Email

Else

ShowForm()

End If
End If

sub ShowForm()

%>
<html>
<head>
<title>search a job</title>
</head>
<body>
<table><tr><td>
<font color=&quot;#1818ac&quot;><b>Search by job sector<br>
<%
Dim oRSv
Set oRSv=Server.CreateObject(&quot;adodb.Recordset&quot;)
oRSv.Open &quot;IndustryTable&quot;, &quot;dsn=50on&quot;
oRSv.MoveFirst
%>

<form method=&quot;post&quot; action=&quot;industrysub.asp?Status=Search&quot; name=form1>
<select name=&quot;industry&quot; size=&quot;1&quot;>
<%
Do While NOT oRSv.EOF
Response.Write &quot;<option value='&quot; & oRSv(&quot;industry&quot;) & &quot;'>&quot;
Response.Write oRSv(&quot;industry&quot;) & &quot;</option>&quot;
oRSv.MoveNext
loop
oRSv.Close
Set oRSv=nothing
%>
</select>
</td><td>
<font color=&quot;#1818ac&quot;><b>Location &amp; Hours</b></font><br><br>
<%
Dim oRSr
Set oRSr=Server.CreateObject(&quot;adodb.Recordset&quot;)
oRSr.Open &quot;RegionTable&quot;, &quot;dsn=50on&quot;
oRSr.MoveFirst
%>

<select name=&quot;region&quot; size=&quot;1&quot;>
<%
Do While NOT oRSr.EOF
Response.Write &quot;<option value='&quot; & oRSr(&quot;region&quot;) & &quot;'>&quot;
Response.Write oRSr(&quot;region&quot;) & &quot;</option>&quot;
oRSr.MoveNext
loop
oRSr.Close
Set oRSr=nothing
%>
</select></td>
<td><br><br>
<%
Dim oRSa
Set oRSa=Server.CreateObject(&quot;adodb.Recordset&quot;)
oRSa.Open &quot;HoursTable&quot;, &quot;dsn=50on&quot;
oRSa.MoveFirst
%>

<select name=&quot;Hours&quot; size=&quot;1&quot;>
<%
Do While NOT oRSa.EOF
Response.Write &quot;<option value='&quot; & oRSa(&quot;Hours&quot;) & &quot;'>&quot;
Response.Write oRSa(&quot;Hours&quot;) & &quot;</option>&quot;
oRSa.MoveNext
loop
oRSa.Close
Set oRSa=nothing
%>
</select>
</td><td><br>
<font color=&quot;#1818ac&quot;><b>add keyword for more precise search</b></font><br><br>
<form method=&quot;post&quot; action=&quot;industrysub.asp?Status=Search&quot; id=form2 name=form2>
<input type=&quot;Text&quot; name=&quot;Jobdescription&quot;>
<input type=&quot;IMAGE&quot; SRC=&quot;go.gif&quot; border=&quot;0&quot; id=IMAGE1 name=IMAGE1>
</form>
</td></tr></table>


<br>
<%
end sub

sub Search()

varindustry=Request.Form(&quot;industry&quot;)
varregion=Request.Form(&quot;region&quot;)
varJobdescription=Request.Form(&quot;Jobdescription&quot;)
varHours=Request.Form(&quot;Hours&quot;)
%>

<%
Dim oRS2
dim iRowCounter
Set oRS2=Server.CreateObject(&quot;adodb.Recordset&quot;)

sSQL=&quot;SELECT JobTable.ID, CompanyTable.ID, JobTable.CompanyID, CompanyTable.Company, JobTable.industry, JobTable.Jobtitle, JobTable.region, JobTable.Jobdescription, JobTable.Hours&quot;
sSQL=sSQL & &quot; FROM JobTable&quot;
sSQL=sSQL & &quot; RIGHT JOIN CompanyTable&quot;
sSQL=sSQL & &quot; ON CompanyTable.ID = JobTable.CompanyID&quot;
sSQl=sSQL & &quot; WHERE Hours='&quot; & varHours & &quot;'&quot;
sSQl=sSQL & &quot; AND industry='&quot; & varindustry & &quot;'&quot;
sSQl=sSQL & &quot; AND region='&quot; & varregion & &quot;'&quot;
sSQl=sSQL & &quot; AND Jobdescription LIKE '%&quot; & varJobdescription & &quot;%'&quot;
sSQL=sSQL & &quot; ORDER BY JobTable.Jobtitle&quot;

oRS2.open sSQL, &quot;DSN=50on&quot;

if oRS2.EOF=True then
Response.write &quot;<font color=#1818ac>Sorry, no jobs were found in this sector&quot;

else oRS2.MoveFirst

response.write &quot;<table bgcolor=#babdd9 align=center width=43% border=0>&quot;

response.write &quot;<th bgcolor=white><img src=jobtitletab.gif></th>&quot; & &quot;<th bgcolor=white><img src=sectortab.gif></th>&quot; & &quot;<th bgcolor=white><img src=companytab.gif></th>&quot; & &quot;<th bgcolor=white><img src=regiontab.gif></th>&quot;


Do while Not oRS2.EOF

Response.Write &quot;<tr><td><a href=displayjob2.asp?ID=&quot; & oRS2 (&quot;ID&quot;) & &quot;>&quot; & oRS2 (&quot;Jobtitle&quot;) & &quot;</a></td>&quot;
Response.Write &quot;<td>&quot; & oRS2 (&quot;industry&quot;) & &quot;</td>&quot;
response.write &quot;<td>&quot; & oRS2 (&quot;Company&quot;) & &quot;</td>&quot;
response.write &quot;<td>&quot; & oRS2 (&quot;region&quot;) & &quot;</td></tr>&quot;

oRS2.MoveNext

Loop
end if
oRS2.Close
set oRS2=Nothing
response.write &quot;</table>&quot;
%>
<table><tr><td>
<form method=&quot;post&quot; action=&quot;industrysub.asp?Status=Email&quot; id=form3 name=form3>
<input type=&quot;hidden&quot; name=&quot;Email&quot;>
<input type=&quot;IMAGE&quot; SRC=&quot;go.gif&quot; border=&quot;0&quot; id=IMAGE1 name=IMAGE1>
</form>
</table></tr></td>
<%
end sub
%>

<%
sub Email()
%>
<%Request(&quot;Company&quot;)=&quot;Company&quot;%> 'this is the problem area'
<%Request(&quot;Jobtitle&quot;)=&quot;Jobtitle&quot;%>
<%Request(&quot;region&quot;)=&quot;region&quot;%>
<%Request(&quot;industry&quot;)=&quot;industry&quot;%>

<%
dim myString 'hold text

myString = &quot;<HTML><HEAD><title>Job request</title></head>&quot; & vbcrlf
myString = myString & &quot;<body>&quot; & vbcrlf
myString = myString & &quot;<table border=0 width=800>&quot; & vbcrlf


myString = myString & &quot;<tr><td>Dear &quot; & Request(&quot;Company&quot;) & &quot;<br><br></td></tr>&quot; & vbcrlf

'myString = myString & &quot;<tr><td>Someone wants this job on &quot;& day(now()) & &quot;/&quot; & month(now()) & &quot;/&quot;
'& year(now()) & &quot; at &quot; & hour(now()) & &quot;:&quot;

'if minute (now()) < 10 then

'else

'myString = myString & minute(now())

'end if

myString = myString & &quot;<tr><td>The job was&quot; & Request(&quot;Jobtitle&quot;) & &quot;</td></tr>&quot; & vbcrlf
myString = myString & &quot;<tr><td>The industry was&quot; & Request(&quot;industry&quot;) & &quot;</td></tr>&quot; & vbcrlf
myString = myString & &quot;<tr><td>The region was&quot; & Request(&quot;region&quot;) & &quot;</td></tr>&quot; & vbcrlf

myString = myString & &quot;</table></body></HTML>&quot;
set myMail = server.CreateObject (&quot;CDONTS.Newmail&quot;)

'send email confirmation

'myAddressString = oRS3(&quot;Email&quot;)

with myMail
.To = &quot;arvin@3la.com&quot;
.from = Application(&quot;NotificationFromAddress&quot;)
.subject = &quot;Job application&quot;
.Body = myString
.MailFormat = 0
.BodyFormat = 0
.send

end with
set myMail = nothing
end sub%>

</font>
</body>
</html>








 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top