PDA

View Full Version : Object doesn't support this property or method



joseph_russell
04-27-2007, 09:23 PM
We upgraded our server from IIS 5.0/Win Serv 2K to IIS 6.0/Win Serv 2K3. After configuring IIS and transfering our website we're getting constant errors trying to run this page that has a good ammount of javascript on it. I'm going to put the pages up in hopes that someone can help me troubleshoot this issue.

error: "Object doesn't support this property or method" on line58 Char 12 of LoadAnything.htm

LoadAnything.htm (shortened to the function I'm having the error on)



<html>
<head>
<title></title></head>
<body>
<link rel="stylesheet" type="text/css" href="../../StyleSheets/WizardsSmall.css">
<form action method="POST" id="form1" name="form1">
<table WIDTH="75%" ALIGN="center" BORDER="1" CELLSPACING="1" CELLPADDING="1">
<tr><td align=center>
Select File to load<br>
<INPUT type="file" id=file1 name=file1><br><input type="button" value="Load file" id="button1" name="button1" onclick="LoadFile()">
</td></tr>
</table></form></body>
<object data="../../ServerIncludes/Scriptlets/FileRead.htm" id="FileReadLib" style="HEIGHT: 0px; LEFT: 0px; TOP: 0px; WIDTH: 0px" type="text/x-scriptlet" VIEWASTEXT></object>
<object data="../../ServerIncludes/Scriptlets/FileReadDOVs.htm" id="FileReadLibDOVs" style="HEIGHT: 0px; LEFT: 0px; TOP: 0px; WIDTH: 0px" type="text/x-scriptlet" VIEWASTEXT></object>
<link href="../../ServerIncludes/adojs.js">
<script LANGUAGE="javascript">
<!--
function LoadFile() {
var AName = document.forms[0].elements[0].value;
var TName = new String(AName);
var BName = TName.toUpperCase();
FileReadLib.LoadExtract(AName); }
//-->
</script>
</html>


FileRead.htm (shortened down to the function being called)


<html>
<object data="../../ServerIncludes/Scriptlets/Connect.asp" id="DataLib" style="HEIGHT: 0px; LEFT: 0px; TOP: 0px; WIDTH: 0px" type="text/x-scriptlet" VIEWASTEXT></object>
<object data="DateLib.htm" id="DateLib" style="HEIGHT: 0px; LEFT: 0px; TOP: 0px; WIDTH: 0px" type="text/x-scriptlet" VIEWASTEXT></object>
<script LANGUAGE="javascript">
<!--

function public_LoadExtract(FName) {
var TheFile, FileStrm;
var M_ssn, M_inits, M_Lname, M_Fname, M_DSSN, M_ruc, M_paycode;
var M_normamt, M_payamt, M_pgrp, M_poe, M_pltcd, Payrollnum, Payrolldate;
var Trash
LineNum = 1;

TheFile = new ActiveXObject("Scripting.FileSystemObject");
FileStrm = TheFile.OpenTextFile(FName,1,false);

// Setup the Database Connection
var SQLCommand, TheRS, TheConnection, DSNString, Commands, MyDC;

FieldNames = new Array("ssn","inits","lname","fname","dssn","ruc","cco",
"payamt","normamt","notsureone","pgrp","poe","pltcode","recstatus",
"paychgflg","paystatuscode","payrollnum","payrolldate");

// Connect the the Database
DataLib.ConToDB();
MyDC = DataLib.GetDC();

PString = prompt("Enter Payroll Number","025");
Payrollnum = parseInt(PString,10);
DString = prompt("Enter Payroll Date","20000101");
Payrolldate = DateLib.FromMil(DString);

var NumRecs = 0;
MyRS = DataLib.GetRS("SELECT * FROM CurExtract");

PayDay = parseInt(DString.substr(6,2),10);

while (! FileStrm.atEndOfStream)
{
What = FileStrm.Read(1);
if (What != '0' && ! FileStrm.atEndOfStream)
{ FileStrm.SkipLine(); }
else
{
if ( ! FileStrm.atEndOfStream)
{
M_ssn = parseInt(FileStrm.Read(9),10);
if (isNaN(M_ssn))
{ M_ssn = 0; }
M_inits = FileStrm.Read(3);
M_Lname = FileStrm.Read(20);
M_Fname = FileStrm.Read(10);
M_DSSN = parseInt(FileStrm.Read(4),10);
if (isNaN(M_DSSN))
{ M_DSSN = 0; }
M_ruc = parseInt(FileStrm.Read(5),10);
if (isNaN(M_ruc))
{ M_ruc = 0; }
M_tempruc = parseInt(FileStrm.Read(5),10);
if (isNaN(M_tempruc))
{ M_tempruc = 0; }
M_fapruc = parseInt(FileStrm.Read(5),10);
if (isNaN(M_fapruc))
{ M_fapruc = 0; }
M_adtempruc = parseInt(FileStrm.Read(5),10);
if (isNaN(M_adtempruc))
{ M_adtempruc = 0; }
M_cco = parseInt(FileStrm.Read(1),10);
if (isNaN(M_cco))
{ M_cco = 0; }

if ( PayDay > 1 && PayDay < 16 )
{
M_normamt = parseInt(FileStrm.Read(5),10);
if (isNaN(M_normamt))
{ M_normamt = 0; }
M_payamt = parseInt(FileStrm.Read(5),10);
if (isNaN(M_payamt))
{ M_payamt = 0; }
} else {
M_payamt = parseInt(FileStrm.Read(5),10);
if (isNaN(M_payamt)) { M_payamt = 0; }
M_normamt = parseInt(FileStrm.Read(5),10);
if (isNaN(M_normamt)) { M_normamt = 0; }
}
M_notsureone = FileStrm.Read(2);
M_pgrp = parseInt(FileStrm.Read(3),10);
if (isNaN(M_pgrp))
{ M_pgrp = 0; }
M_poe = parseInt(FileStrm.Read(5),10);
if (isNaN(M_poe))
{ M_poe = 0; }
M_pltcd = FileStrm.Read(4);
M_recstatus = FileStrm.Read(1);
M_paychgflg = FileStrm.Read(1);
M_paystatuscode = parseInt(FileStrm.Read(5),10);
if (isNaN(M_paystatuscode))
{ M_paystatuscode = 0; }

if (M_paystatuscode == 2100)
{
M_normamtTEMP = M_normamt;
M_payamtTEMP = M_payamt;

M_normamt = M_payamtTEMP;
M_payamt = M_normamtTEMP;
}

Trash = FileStrm.Read(2);
if (M_ruc == 0 && M_tempruc == 0 && M_fapruc == 0 && M_adtempruc == 0)
{ M_ruc = M_ruc; }
else
{
if (M_ruc != 0 && M_tempruc == 0 && M_fapruc == 0 && M_adtempruc == 0)
{ M_ruc = M_ruc; }
else
{
if (M_ruc != 0 && M_tempruc != 0 && M_fapruc == 0 && M_adtempruc == 0)
{ M_ruc = M_tempruc; }
else
{
if (M_ruc != 0 && M_tempruc != 0 && M_fapruc == 0 && M_adtempruc != 0)
{ M_ruc = M_adtempruc; }
else
{
if (M_ruc != 0 && M_tempruc == 0 && M_fapruc != 0 && M_adtempruc == 0)
{ M_ruc = M_fapruc; }
else
{
if (M_ruc != 0 && M_tempruc != 0 && M_fapruc != 0 && M_adtempruc == 0)
{ M_ruc = M_tempruc; }
}
}
}
}
}

if (M_DSSN != 5199 && M_DSSN != 6109 && M_DSSN != 6168 && M_DSSN != 6795 && M_DSSN != 6796 && M_DSSN != 6798 && M_DSSN != 6816 )
{
FieldData = new Array(M_ssn,M_inits,M_Lname,M_Fname,M_DSSN,M_ruc,
M_cco,M_payamt,M_normamt,M_notsureone,M_pgrp,
M_poe,M_pltcd,M_recstatus,M_paychgflg,
M_paystatuscode,Payrollnum,Payrolldate);

MyRS.AddNew(FieldNames,FieldData);
}
NumRecs++;
if (NumRecs == 10000)
{
MyDC.SubmitChanges();
NumRecs = 0;
}
}
}
}
MyDC.SubmitChanges();
FileStrm.Close();
//MyTest = DataLib.GetRS("PaydayUpdate2");
alert("Update complete");
}
//-->
</script>
</html>


Connect.asp


<%@ LANGUAGE="JSCRIPT" %>
<!--#INCLUDE FILE="../DataConnJ.asp"-->
<html>
<body>
<!-- RDS.DataControl for holding the buffered Data (I Guess) -->
<object ID="DC" CLASSID="CLSID:BD96C556-65A3-11D0-983A-00C04FC29E33" WIDTH="0" HEIGHT="0" VIEWASTEXT>
<param NAME="AllowAddNew" VALUE="TRUE">
<param NAME="AllowDelete" VALUE="TRUE">
<param NAME="AllowUpdate" VALUE="TRUE">
</object>
<!-- RDS.DataSpace for communicating with the server -->
<object ID="DP" CLASSID="CLSID:BD96C556-65A3-11D0-983A-00C04FC29E36" WIDTH="0" HEIGHT="0" VIEWASTEXT>

</object>
<input type="hidden" name="text1" value="<%=WhatServer%>">
</body>

<script src="../adojs.js"></script>
<script src="../adoconjs.js"></script>
<script src="../adomdjs.js"></script>
<script src="../adoxjs.js"></script>
<script src="../rdsjs.js"></script>

<script LANGUAGE="javascript">
<!--
var DSNString, TheDF, TheRS;
//DSNString = "DSN=TestWeb; UID=; PWD=";
DSNString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=c:/TheData/TestDisbo.mdb";

function public_ConToDB()
{
TheDF = DP.CreateObject("RDSServer.DataFactory",this.text1.value);
DC.DataSpace=DP;
DC.Server = this.text1.value;
DC.Open = DSNString;
//DC.Connect="d:\thedata\disboweb.udl";
}

function public_GetRS()
{
var SQLCommand;
SQLCommand = "SELECT * FROM CurExtract";
TheRS = TheDF.Query(DSNString,SQLCommand);
DC.SourceRecordset=TheRS;
return (TheRS);
}
function public_GetDC()
{
return (DC);
}
//-->
</script>
</html>


DataConnJ.asp



<%
Response.Expires = 0;
var UserName = new String(Request.ServerVariables("AUTH_USER"));
var UName = UserName.substr(UserName.indexOf("\\",0)+1);
UserName = UName;
var WhatServer = Request.ServerVariables("SERVER_NAME");

if (Request.ServerVariables("SERVER_PORT_SECURE") == 1)
{ WhatServer1 = "https://" + WhatServer;}
else
{ WhatServer1 = "http://" + WhatServer; }

WhatServer = WhatServer1;

var CONNECTION = Server.CreateObject("ADODB.CONNECTION");
CONNECTION.Open("DSN=TestWeb; UID=; PWD=");
%>


I did not write this. It worked fine on the older server, but we can't get it to run. I'm not very proficient in Java and any help would be GREATLY appreciated.

Sincerly,
Joseph Russell

jscheuer1
04-27-2007, 09:42 PM
It still isn't clear what line you are talking about and probably doesn't matter. If the only thing that you changed was servers, even though the error is noticed as a javascript error, it probably is something different on the new server.

Does the new server even support asp? If so, is it a different version or set up with different parameters? Are all of your include files properly in place? If any database is used, is it up and running properly?

joseph_russell
04-27-2007, 09:52 PM
I get the error on this line:


FileReadLib.LoadExtract(AName);

in LoadAnything.htm

I have made a page called test.asp to connect to the database and display some data on the page. This does work:

Test.asp


<%@ Language="JScript"%>

<%
//DSN-less Connection string to the database

var sdbConnString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=c:/TheData/TestDisbo.mdb";


//Response.Write(Session("data_conn"));
if (Session("data_conn") != null)
cnn = Session("data_conn")
else
{
cnn = Server.CreateObject("ADODB.Connection");
cnn.Mode = 3;
cnn.Open(sdbConnString);
Session("data_conn") = cnn
}
%>


<%
RS = Server.CreateObject("ADODB.Recordset");
SQLstmt = "SELECT * FROM ACIDS";
RS.Open(SQLstmt, cnn, 3);

if (!RS.BOF && !RS.EOF) {
while(!RS.EOF) {
Response.Write(RS("ACID") + "<br>");
Response.Write(RS("SSN") + "<br>");
RS.MoveNext();
}
}
%>

}
//-->
</script>

The files/directories are example the same as on the previous server. So I've concluded that I'm able to connect and the database is running. I'm willing to take this step by step.

jscheuer1
04-27-2007, 10:24 PM
That would suggest that:

document.forms[0].elements[0].value;

either isn't what:

FileReadLib.LoadExtract()

is expecting or that:

FileReadLib

hasn't been defined or that:

FileReadLib.LoadExtract

hasn't been defined. The first issue would depend upon:


<INPUT type="file" id=file1 name=file1>

Having a value in the range expected when:


<input type="button" value="Load file" id="button1" name="button1" onclick="LoadFile()">

is clicked. The rest would depend on all of the resource files mentioned before:

FileReadLib.LoadExtract

being in good shape and being available in the locations indicated.

joseph_russell
05-03-2007, 07:56 PM
the error has to lie somewhere in this function:


function public_GetRS()
{
var SQLCommand;
SQLCommand = "SELECT * FROM CurExtract";
TheRS = TheDF.Query(DSNString,SQLCommand);
DC.SourceRecordset=TheRS;
return (TheRS);
}


I'm assuming on this line:


TheRS = TheDF.Query(DSNString,SQLCommand);

Can someone see anything wrong with my code or anything I would need to install or configure within IIS 6.0 that doesn't done by default. Please help I am so lost.