Hi Rajani,
Thanks for the prompt reply.
If you look at the code below I execute the recordset in the fnshowschool function but when i try to access the same recordset in the sendemailfunction below it is not able to recognise that there is something in the recordset.
Response.Write fnShowSchool & "<br>"
dim rsGetSchool
set rsGetSchool = server.createobject("ADODB.recordset")
function fnShowSchool
Set sqlConn = Server.CreateObject("ADODB.Connection")
sqlConn.Open application("vadmin_db")
Set cmdGetSchool = Server.CreateObject("ADODB.Command")
with cmdGetSchool
.CommandText = "scott.school_transfer_details"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("@DfEEID", adinteger, adParamInput)
.Parameters("@DfEEID").Value = Request.QueryString("DfEEID")
.ActiveConnection = sqlConn
set rsGetSchool = .Execute
end with
strMainBody=""
if not rsGetSchool.EOF then
strMainBody=strMainBody & "<tr><form name=""frmSchool"" method=post action=""showSchoolTransfer.asp?up=yes&DfEEID=" & request("DfEEID") & """>" & vbcrlf
strMainBody=strMainBody & "<tr><td bgcolor='#336699'><b>School Name:</b></td>" & vbcrlf
strMainBody=strMainBody & "<tr><td bgcolor='#336699'> </td><td bgcolor='#336699'><input type=""submit"" name=""submit"" value=""Transfer School""></td>" & vbcrlf strMainBody=strMainBody & "</tr></td>" & vbcrlf
end if
set rsGetOpp = nothing
set cmdGetSchool = nothing
fnShowSchool = strMainBody
end function
'spring clean
set rsGetOpp = nothing
set cmdGetOpp = nothing
%>
<%
set sqlConn = Server.CreateObject("ADODB.Connection")
sqlConn.Open application("vadmin_db")
un = Session("Username")
Set rsUsers = Server.CreateObject("ADODB.Recordset")
Set rsIDs = Server.CreateObject("ADODB.Recordset")
Set sqlConn2 = Server.CreateObject("ADODB.Connection")
sqlConn2.Open "Driver={SQL Server}; Server=" & serverName & "; Database=GS; UID=gs_user; PWD=gs_pass"
sqlQuery = "SELECT ID FROM BT_Users WHERE Username='" & un&"';"
rsUsers.open sqlQuery,sqlConn2
thisUserID = ""
if not rsUsers.EOF Then
thisUserID = rsUsers("ID")
End if
sqlQuery = "SELECT RestrictValue FROM BT_RecordAccess WHERE UserID="&thisUserID
rsIDs.open sqlQuery,sqlConn2
thisUserID = ""
if not rsIDs.EOF Then
thisUserID = rsIDs("RestrictValue")
end if
Set sqlConn3 = Server.CreateObject("ADODB.Connection")
sqlConn3.Open application("vadmin_db")
Set getclbname = Server.CreateObject("ADODB.Command")
with getclbname
.ActiveConnection = sqlConn
.CommandText = "getclubname"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("@ClubID", adinteger, adParamInput) .Parameters("@ClubID").Value = thisUserID
set rsname = .Execute
end with
if Request.QueryString("up") = "yes" then
call sendemail()
end if
function sendemail()
Set sendmail = Server.CreateObject("CDONTS.NewMail")
sendmail.From = "
[email protected]"
'The mail is sent to the address
sendmail.To = "
[email protected]"
sendmail.Subject = "School Transfer"
sendmail.MailFormat = 0
'This is the content of thr message.
sendmail.Body = "Dear Sir," & vbCrLf & vbCrLf & "The following School is requested to be transfered " & _
vbCrlf & "School Name :" & _
vbCrlf & "Contact Name :" & _
vbCrlf & "Address Line 1 :" & _
vbCrlf & "Address Line 2 :" & _
vbCrlf & "Address Line 3 :" & _
vbCrlf & "Country :" & _
vbCrlf & "Post Code :" & _
vbCrlf & "To Club Name :" & rsname("ClubName") & _
vbCrlf & vbCrlf & "Best Regards"
'this sets mail priority.... 0=low 1=normal 2=high
sendmail.Importance = 2
sendmail.Send 'Send the email!
end function
%>