|
 |
asp_cdo thread: CDO giving
Message #1 by "Jason Guthrie" <jason@j...> on Fri, 23 Nov 2001 23:04:51
|
|
This form shown below submits CALLID to the code on the bottom of this
post. The bottom code querries, get data and displays that info on the
page. A submit button is then supposed to go ahead and CDO the queried
results to an email address. Instead:
Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.
/email/02-PopulateCDOFields.asp
<%
Dim objDC, objRS, strConn, xrs, strsql, ValueOfNull
strConn = "DSN=HEAT;UID=sa;Password="
ValueOfNull = ""
' Create and establish data connection
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.ConnectionTimeout = 15
objDC.CommandTimeout = 30
objDC.Open strConn
strsql = "SELECT * FROM Detail "
strsql = strsql & "Where R2StoreNum <> '" &ValueOfNull & "'"
strsql = strsql & "ORDER BY CallID DESC"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strsql, objDC, 0, 1
' Loop through recordset and display results
If Not objRS.EOF Then
objRS.MoveFirst
' the form below calls this file only this time with an id in the
QueryString
%>
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<!-- START OF THIS PAGES CONTENT --><!-- START OF THIS PAGES CONTENT --><!-
- START OF THIS PAGES CONTENT --><!-- START OF THIS PAGES CONTENT -->
<FORM ACTION="02-PopulateCDOFields.asp" METHOD="get">
<SELECT NAME="CallID">
<OPTION></OPTION>
<%
' Continue until we get to the end of the recordset.
Do While Not objRS.EOF
' For each record we create a option tag and set it's
value to the employee id
' The text we set to the employees first name combined
with a space and then their last name
%>
<!--SETS VALUE-->
<OPTION VALUE="<%= objRS.Fields("CallID") %>">Call ID:
<!--SETS DISPLAY-->
<%= objRS.Fields("CallID") & " Store: " & objRS.Fields
("R2StoreName") %>
</OPTION>
<%
' Get next record
objRS.MoveNext
Loop
%>
</SELECT>
<input type="submit" value="Fill in email fields because filling
it in myself sucks and is lame!!!" name="Confirm">
</FORM>
<%
End If
' Close Data Access Objects and free DB variables
objRS.Close
Set objRS = Nothing
objDC.Close
Set objDC = Nothing
%>
</center>
<!-- END OF THIS PAGES CONTENT --><!-- END OF THIS PAGES CONTENT --><!--
END OF THIS PAGES CONTENT --><!-- END OF THIS PAGES CONTENT -->
</HTML>
-------------------------The Other Page------------------------------------
<%
'Option Explicit
Dim strTo, strSubject, strBody, strFrom, from, subject, body, objCDOMail,
strSubt
'''''''''''''''''''''''''''''''''''''''''
strTo ="jason.guthrie@g..."
strSubject = Request.Form("CallID")
strFrom = "Helpdesk@g..."
strBody = "2nd Day Delivery: Yes"
'strBody = strBody & vbCrLf & "Store #: " & Request.Form("R2StoreNum")
'strBody = strBody & vbCrLf & "Name: Gotts"
'strBody = strBody & vbCrLf & "Address: " & Request.Form("R2StoreName")
'strBody = strBody & vbCrLf & "City: " & Request.Form("R2StoreCity")
'strBody = strBody & vbCrLf & "State/Zip:" & Request.Form("R2StoreState")
& Request.Form("R2StoreZip")
'strBody = strBody & vbCrLf & "Telephone: " & Request.Form("R2StorePhone")
'strBody = strBody & vbCrLf & "Contact: " & Request.Form("R2StoreContact1")
'strBody = strBody & vbCrLf & vbCrLf & vbCrLf
'strBody = strBody & vbCrLf & "QTY. Item"
'strBody = strBody & vbCrLf & "-----------------------------"
'strBody = strBody & vbCrLf & Request.Form("R2_qty_1") & " " &
Request.Form("R2_item_1")
'strBody = strBody & vbCrLf & Request.Form("R2_qty_2") & " " &
Request.Form("R2_item_2")
'strBody = strBody & vbCrLf & Request.Form("R2_qty_3") & " " &
Request.Form("R2_item_3")
'strBody = strBody & vbCrLf & Request.Form("R2_qty_4") & " " &
Request.Form("R2_item_4")
'strBody = strBody & vbCrLf & Request.Form("R2_qty_5") & " " &
Request.Form("R2_item_5")
'strBody = strBody & vbCrLf & Request.Form("R2_qty_6") & " " &
Request.Form("R2_item_6")
'strBody = strBody & vbCrLf & "-----------------------------"
'strBody = strBody & vbCrLf & "Ticket #:" & Request.Form("CallID")
If strSubject = "" Then
Dim strConn, objRS, objDC, curVal, strsql, CallID
CallID = Request.QueryString("CallID")
strConn = "DSN=HEAT;UID=sa;Password="
' Open Connection to the database
set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open strConn
strsql = "SELECT CallID, R2StoreNum, R2StoreName, R2StoreAddress1,
R2StoreAddress2, R2StoreCity, R2StoreState, R2StoreZip, R2StorePhone,
R2StoreContact1, R2StoreContact2, R2_item_1, R2_qty_1, R2_item_2,
R2_qty_2, R2_item_3, R2_qty_3, R2_item_4, R2_qty_4, R2_item_5, R2_qty_5,
R2_item_6, R2_qty_6 FROM Detail "
strsql = strsql & "WHERE CallID = '" & CallID & "'"
set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strsql, objDC
'objRS.Open strsql, objDC, 0, 1
%>
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM ACTION="./02-PopulateCDOFields.asp" METHOD="post">
<B>Call ID:</B>
<%= objRS.Fields("CallID") %>
<BR>
<B>Store #:</B>
<%= objRS.Fields("R2StoreNum") %>
<BR>
<B>Store Name:</B>
<%= objRS.Fields("R2StoreName") %>
<BR>
<B>Store Address 1:</B>
<%= objRS.Fields("R2StoreAddress1") %>
<BR>
<B>Store Address 2:</B>
<%= objRS.Fields("R2StoreAddress2") %>
<BR>
<B>Store City:</B>
<%= objRS.Fields("R2StoreCity") %>
<BR>
<B>Store State:</B>
<%= objRS.Fields("R2StoreState") %>
<BR>
<B>Store Zip:</B>
<%= objRS.Fields("R2StoreZip") %>
<BR>
<B>Store Phone:</B>
<%= objRS.Fields("R2StorePhone") %>
<BR>
<B>Store Contact 1:</B>
<%= objRS.Fields("R2StoreContact1") %>
<BR>
<B>Store Contact 2:</B>
<%= objRS.Fields("R2StoreContact2") %>
<BR>
<B>Qty 1:</B>
<%= objRS.Fields("R2_item_1") %>
<B>Qty 1:</B>
<%= objRS.Fields("R2_qty_1") %>
<BR>
<B>Qty 2:</B>
<%= objRS.Fields("R2_item_2") %>
<B>Qty 2:</B>
<%= objRS.Fields("R2_qty_2") %>
<BR>
<B>Qty 3:</B>
<%= objRS.Fields("R2_item_3") %>
<B>Qty 3:</B>
<%= objRS.Fields("R2_qty_3") %>
<BR>
<B>Qty 4:</B>
<%= objRS.Fields("R2_item_4") %>
<B>Qty 4:</B>
<%= objRS.Fields("R2_qty_4") %>
<BR>
<B>Qty 5:</B>
<%= objRS.Fields("R2_item_5") %>
<B>Qty 5:</B>
<%= objRS.Fields("R2_qty_5") %>
<BR>
<B>Qty 6:</B>
<%= objRS.Fields("R2_item_6") %>
<B>Qty 6:</B>
<%= objRS.Fields("R2_qty_6") %>
<BR>
<input type="submit" value="SEND TO R2" name="B1">
</form>
<%
objRS.Close
Set objRS = Nothing
objDC.Close
Set objDC = Nothing
Else
'Once strSubject has a value: Send email
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = strFrom
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
objCDOMail.Send
Set objCDOMail = Nothing
Response.Write ("<center><font size=2 >Message sent to </font><a
href=" & "mailto:jason.guthrie@g..." & ">Helpdesk</a></center>")
End If
%>
Message #2 by "Jason Guthrie" <jason@j...> on Fri, 23 Nov 2001 23:08:27
|
|
Forgot to put a full subject ;) and to thank you folks in advance.
THANKS!!!
> This form shown below submits CALLID to the code on the bottom of this
> post. The bottom code querries, get data and displays that info on the
> page. A submit button is then supposed to go ahead and CDO the queried
> results to an email address. Instead:
>
> Error Type:
> ADODB.Field (0x80020009)
> Either BOF or EOF is True, or the current record has been deleted.
> Requested operation requires a current record.
> /email/02-PopulateCDOFields.asp
>
>
> <%
> Dim objDC, objRS, strConn, xrs, strsql, ValueOfNull
> strConn = "DSN=HEAT;UID=sa;Password="
>
> ValueOfNull = ""
> ' Create and establish data connection
> Set objDC = Server.CreateObject("ADODB.Connection")
>
> objDC.ConnectionTimeout = 15
> objDC.CommandTimeout = 30
> objDC.Open strConn
>
> strsql = "SELECT * FROM Detail "
> strsql = strsql & "Where R2StoreNum <> '" &ValueOfNull & "'"
> strsql = strsql & "ORDER BY CallID DESC"
>
> Set objRS = Server.CreateObject("ADODB.Recordset")
> objRS.Open strsql, objDC, 0, 1
>
> ' Loop through recordset and display results
> If Not objRS.EOF Then
> objRS.MoveFirst
> ' the form below calls this file only this time with an id in the
> QueryString
> %>
>
>
> <HTML>
> <HEAD>
> <TITLE></TITLE>
>
> </HEAD>
> <!-- START OF THIS PAGES CONTENT --><!-- START OF THIS PAGES CONTENT --
><!-
> - START OF THIS PAGES CONTENT --><!-- START OF THIS PAGES CONTENT -->
> <FORM ACTION="02-PopulateCDOFields.asp" METHOD="get">
> <SELECT NAME="CallID">
> <OPTION></OPTION>
> <%
> ' Continue until we get to the end of the recordset.
> Do While Not objRS.EOF
> ' For each record we create a option tag and set it's
> value to the employee id
> ' The text we set to the employees first name combined
> with a space and then their last name
> %>
> <!--SETS VALUE-->
> <OPTION VALUE="<%= objRS.Fields("CallID") %>">Call ID:
> <!--SETS DISPLAY-->
> <%= objRS.Fields("CallID") & " Store: " & objRS.Fields
> ("R2StoreName") %>
> </OPTION>
> <%
> ' Get next record
> objRS.MoveNext
> Loop
> %>
> </SELECT>
> <input type="submit" value="Fill in email fields because filling
> it in myself sucks and is lame!!!" name="Confirm">
> </FORM>
> <%
> End If
>
> ' Close Data Access Objects and free DB variables
> objRS.Close
> Set objRS = Nothing
> objDC.Close
> Set objDC = Nothing
> %>
> </center>
> <!-- END OF THIS PAGES CONTENT --><!-- END OF THIS PAGES CONTENT --><!--
> END OF THIS PAGES CONTENT --><!-- END OF THIS PAGES CONTENT -->
>
> </HTML>
>
> -------------------------The Other Page----------------------------------
--
> <%
> 'Option Explicit
> Dim strTo, strSubject, strBody, strFrom, from, subject, body,
objCDOMail,
> strSubt
>
> '''''''''''''''''''''''''''''''''''''''''
> strTo ="jason.guthrie@g..."
> strSubject = Request.Form("CallID")
> strFrom = "Helpdesk@g..."
> strBody = "2nd Day Delivery: Yes"
> 'strBody = strBody & vbCrLf & "Store #: " & Request.Form("R2StoreNum")
> 'strBody = strBody & vbCrLf & "Name: Gotts"
> 'strBody = strBody & vbCrLf & "Address: " & Request.Form("R2StoreName")
> 'strBody = strBody & vbCrLf & "City: " & Request.Form("R2StoreCity")
> 'strBody = strBody & vbCrLf & "State/Zip:" & Request.Form
("R2StoreState")
> & Request.Form("R2StoreZip")
> 'strBody = strBody & vbCrLf & "Telephone: " & Request.Form
("R2StorePhone")
> 'strBody = strBody & vbCrLf & "Contact: " & Request.Form
("R2StoreContact1")
> 'strBody = strBody & vbCrLf & vbCrLf & vbCrLf
> 'strBody = strBody & vbCrLf & "QTY. Item"
> 'strBody = strBody & vbCrLf & "-----------------------------"
> 'strBody = strBody & vbCrLf & Request.Form("R2_qty_1") & " " &
> Request.Form("R2_item_1")
> 'strBody = strBody & vbCrLf & Request.Form("R2_qty_2") & " " &
> Request.Form("R2_item_2")
> 'strBody = strBody & vbCrLf & Request.Form("R2_qty_3") & " " &
> Request.Form("R2_item_3")
> 'strBody = strBody & vbCrLf & Request.Form("R2_qty_4") & " " &
> Request.Form("R2_item_4")
> 'strBody = strBody & vbCrLf & Request.Form("R2_qty_5") & " " &
> Request.Form("R2_item_5")
> 'strBody = strBody & vbCrLf & Request.Form("R2_qty_6") & " " &
> Request.Form("R2_item_6")
> 'strBody = strBody & vbCrLf & "-----------------------------"
> 'strBody = strBody & vbCrLf & "Ticket #:" & Request.Form("CallID")
>
> If strSubject = "" Then
>
> Dim strConn, objRS, objDC, curVal, strsql, CallID
> CallID = Request.QueryString("CallID")
> strConn = "DSN=HEAT;UID=sa;Password="
>
> ' Open Connection to the database
> set objDC = Server.CreateObject("ADODB.Connection")
> objDC.Open strConn
>
> strsql = "SELECT CallID, R2StoreNum, R2StoreName, R2StoreAddress1,
> R2StoreAddress2, R2StoreCity, R2StoreState, R2StoreZip, R2StorePhone,
> R2StoreContact1, R2StoreContact2, R2_item_1, R2_qty_1, R2_item_2,
> R2_qty_2, R2_item_3, R2_qty_3, R2_item_4, R2_qty_4, R2_item_5, R2_qty_5,
> R2_item_6, R2_qty_6 FROM Detail "
> strsql = strsql & "WHERE CallID = '" & CallID & "'"
>
> set objRS = Server.CreateObject("ADODB.Recordset")
> objRS.Open strsql, objDC
> 'objRS.Open strsql, objDC, 0, 1
>
> %>
>
> <HTML>
> <HEAD>
> <TITLE></TITLE>
> </HEAD>
> <BODY>
>
> <FORM ACTION="./02-PopulateCDOFields.asp" METHOD="post">
>
> <B>Call ID:</B>
> <%= objRS.Fields("CallID") %>
> <BR>
>
> <B>Store #:</B>
> <%= objRS.Fields("R2StoreNum") %>
> <BR>
>
> <B>Store Name:</B>
> <%= objRS.Fields("R2StoreName") %>
> <BR>
>
> <B>Store Address 1:</B>
> <%= objRS.Fields("R2StoreAddress1") %>
> <BR>
>
> <B>Store Address 2:</B>
> <%= objRS.Fields("R2StoreAddress2") %>
> <BR>
>
> <B>Store City:</B>
> <%= objRS.Fields("R2StoreCity") %>
> <BR>
>
> <B>Store State:</B>
> <%= objRS.Fields("R2StoreState") %>
> <BR>
>
> <B>Store Zip:</B>
> <%= objRS.Fields("R2StoreZip") %>
> <BR>
>
> <B>Store Phone:</B>
> <%= objRS.Fields("R2StorePhone") %>
> <BR>
>
> <B>Store Contact 1:</B>
> <%= objRS.Fields("R2StoreContact1") %>
> <BR>
>
> <B>Store Contact 2:</B>
> <%= objRS.Fields("R2StoreContact2") %>
> <BR>
>
> <B>Qty 1:</B>
> <%= objRS.Fields("R2_item_1") %>
> <B>Qty 1:</B>
> <%= objRS.Fields("R2_qty_1") %>
> <BR>
>
> <B>Qty 2:</B>
> <%= objRS.Fields("R2_item_2") %>
> <B>Qty 2:</B>
> <%= objRS.Fields("R2_qty_2") %>
> <BR>
>
> <B>Qty 3:</B>
> <%= objRS.Fields("R2_item_3") %>
> <B>Qty 3:</B>
> <%= objRS.Fields("R2_qty_3") %>
> <BR>
>
> <B>Qty 4:</B>
> <%= objRS.Fields("R2_item_4") %>
> <B>Qty 4:</B>
> <%= objRS.Fields("R2_qty_4") %>
> <BR>
>
> <B>Qty 5:</B>
> <%= objRS.Fields("R2_item_5") %>
> <B>Qty 5:</B>
> <%= objRS.Fields("R2_qty_5") %>
> <BR>
>
> <B>Qty 6:</B>
> <%= objRS.Fields("R2_item_6") %>
> <B>Qty 6:</B>
> <%= objRS.Fields("R2_qty_6") %>
> <BR>
>
> <input type="submit" value="SEND TO R2" name="B1">
> </form>
>
> <%
>
> objRS.Close
> Set objRS = Nothing
> objDC.Close
> Set objDC = Nothing
>
> Else
> 'Once strSubject has a value: Send email
> Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
> objCDOMail.From = strFrom
> objCDOMail.To = strTo
> objCDOMail.Subject = strSubject
> objCDOMail.Body = strBody
> objCDOMail.Send
> Set objCDOMail = Nothing
> Response.Write ("<center><font size=2 >Message sent to </font><a
> href=" & "mailto:jason.guthrie@g..." & ">Helpdesk</a></center>")
>
> End If
>
> %>
|
|
 |