?
Solved

Jscript and ADO batch update

Posted on 2004-08-03
3
Medium Priority
?
521 Views
Last Modified: 2008-03-17
OK....

Now i have this code - but it doesn't seem to be updating the records i want! And i don't get any error messages either! :o((

Incidently, i'm new to Jscript - i've only ever used vbscript before in conjunction with ASP - can someone please take a look and tell me what the problem may be????

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/cnx.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
var Msg
var cnnSearch = Server.CreateObject("ADODB.Connection");
cnnSearch.Open(cnx_STRING);
var sqlstr = "SELECT DISTINCTROW * FROM [Personnel Details_real] WHERE [Employee Reference] = " & Request.QueryString("id") & ";"
var rst = Server.CreateObject("ADODB.Recordset");
rst.Open("[Personnel Details_real]", cnnSearch, 2, 3);

   if (Request.Form["txtcpdref"] != "") {
        rst["CPDRef"] == Request.Form["txtcpdref"];
            Msg == "Yeah it saved!"
    }
    else {
        rst["CPDRef"] == null;
    }

    rst.Update();
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<%=Msg%>
</body>
</html>
0
Comment
Question by:biz1976
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
neeraj523 earned 900 total points
ID: 11701809
Hello

replace this

if (Request.Form["txtcpdref"] != "") {
        rst["CPDRef"] == Request.Form["txtcpdref"];
          Msg == "Yeah it saved!"
    }
    else {
        rst["CPDRef"] == null;
    }

TO

if (Request.Form["txtcpdref"] != "") {
        rst["CPDRef"] = Request.Form["txtcpdref"]
          Msg = "Yeah it saved!"
    }
    else {
        rst["CPDRef"] = null;
    }

neeraj523
0
 

Author Comment

by:biz1976
ID: 11701926
Hey Neeraj,

Thanks for the above - however - i now get an error saying:

Microsoft JScript runtime error '800a01b6'

Object doesn't support this property or method

/techsupport/save_emailaddress.asp, line 13

if (Request.Form["txtcpdref"] != "") {
        rst["CPDRef"] = Request.Form["txtcpdref"] <------- line 13
          Msg = "Yeah it saved!"
    }
    else {
        rst["CPDRef"] = null;
    }
0
 

Author Comment

by:biz1976
ID: 11702569
It's ok - Thanks Neeraj i've sorted it now.  Thanks for your help.

The problems i had were these:

In the rst.Open statement - i forgot to replace the table name with the sqlstr variable.  And also, when doing request.forms, and referencing specific fields within the recordset object - u musn't use square brackets and instead use curly brackets!

Thanks for the help
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question