is this the right syntax?

Results 1 to 2 of 2

Thread: is this the right syntax?

  1. #1
    Join Date
    Dec 1969

    Default is this the right syntax?

    I am trying to see if a record exists, and if it does not, write the new record. This is my 1st attempt at using javascript, i am used to using vbscript....<BR><BR>&#060;%@ Language=JavaScript %&#062;<BR><BR>&#060;%<BR><BR>// submit metadata information<BR><BR>var prof1=Request.Item("presselProfile")<BR>var RequestedTitle=Request.Item("presTitle")<BR><BR>co nDB = Application("eCast_ConnectionString"); <BR>conDB.ConnectionTimeout = 2;<BR>conDB.CommandTimeout = 2;<BR>conDB.CursorLocation = 3; <BR> <BR>szSQL = "SELECT * FROM CMRC_Webcasts WHERE Title=" & RequestedTitle & ";";<BR>rs = Server.CreateObject("ADODB.Recordset");<BR> (szSQL, conDB, 3, 3);<BR>var Exists=rs("Title")<BR><BR>IF (Exists==null) {<BR><BR>rgFields = new Array("Publishname","Description","Author","Copyri ght","Title","PublishPointID","Expiry","TypeOfWebc astID");<BR>rgValues = new Array(Request.Item("presname"), Request.Item("presdetail"), Request.Item("presAuthor"), Request.Item("presCopyright"), Request.Item("presTitle"), Request.Item("presDepartment"), Request.Item("presExpiry"), Request.Item("presTypeOfWebcast"));<BR><BR>rs.addN ew(rgFields, rgValues);<BR>rs.Update();<BR><BR>}<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default That doesn't work in VBS either...

    Even in VBS you can&#039;t do<BR><BR>exists = rs("Title") <BR><BR>if the recordset is empty (no records were returned).<BR><BR>How SHOULD you do it in VBScript??? Hint: Remember the EOF property?<BR><BR>Oh...and JavaScript is CASE SENSITIVE.<BR><BR>You can&#039;t use IF when you mean if. <BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts