Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: Small but important inconsistency with cdo/sql


Message #1 by "ian neish" <ian.neish@n...> on Tue, 19 Sep 2000 14:22:47 +0100
This script below works perfectly on my home server, with Win 2K, exchange

2K rc2,IIS 5 etc, but on the office server Win 2K sp1, Exchange 2k eval

edition, IIS 5 etc. The machine at home sends the id in the email to the

helpdesk(reading from the record after posting as it is an autonumber) but

the office on doesn't. it didn't from NT 4, IIS4 on an Alha as well.



To all intents and purposes the machines are the same, but the id is

magically missing. Anyone have any idea why or a fix?



Also with CDo is there a limit to the length of the body in the email as I

seem to hit a barrier if the message is much longer than this especially

with the hyperlink included.



thanks



Ian



<p><%





Dim con

Dim rst

Const adOpenKeyset = 1 

Const adLockOptimistic = 3







'Create the objects 



Set con = Server.CreateObject("ADODB.Connection") 

Set rst = Server.CreateObject("ADODB.Recordset") 



con.Open "webdb", "sa", "" 



' Create a keyset recordset based on the 

' Faults table with optimistic locking 



rst.Open "SELECT * FROM faults", con, _

 adOpenKeyset, adLockOptimistic 

' Create a new blank record 

rst.AddNew 

' Set the fields to the user-entered values 

' from the html form used to collect the data

rst("UserName")=Request.Form("UserName") 

rst("Location")=Request.Form("Location") 

rst("Room")=Request.Form("Room") 

rst("Nature")= Request.Form("Nature")

rst("Description")=Request.Form("Description") 

rst("OS")= Request.Form("OS")

rst("Urgency")= Request.Form("Urgency")

rst("Completion")= Request.Form("Completion")

rst("Location")= Request.Form("Location")

rst("Time")= Now 

rst("Closed")= "N"

' Save the new record to the database 

rst.Update



Response.Write "<B>Thank you! you request will be dealt with as quickly as

possible</B>"





Dim objCDO

Set objCDO=Server.CreateObject("CDONTS.NewMail")

objCDO.To=("Helpdesk@x...")

objCDO.From= Request.form("UserName")

objCDO.Subject= Request.form("Nature") 

objCDO.Body=  "Click here to pick up this job" & vblf &

"http://alphadelta/open_job_form.asp?id=" & rst("id")  & vbcrlf &

"Description of the job" & vbcrlf & Request.form("Description") & vbcrlf &

"Operating system" & vbcrlf & Request.form("OS") & vbcrlf & "Urgency" &

vbcrlf & Request.form("Urgency") & vbcrlf & "Required completion" & vbcrlf

& Request.form("Completion")

objCDO.Send



rst.Close

con.Close





%> </p>


  Return to Index