?
Solved

Jscript and ADO batch update

Posted on 2004-08-03
3
Medium Priority
?
520 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

770 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