|
 |
asp_databases thread: Microsoft VBScript runtime error '800a01f4'
Message #1 by Leo Clayton <claytonl@z...> on Wed, 29 Nov 2000 16:50:42 -0500
|
|
--=====================_1065757498==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
Can someone out there tell me why I got this error?
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'IDNumber'
/EmployeeMasterStuff/DeleteEmployeeSkillRecords.asp, line 37
This is line 37:
objRS.Filter = (IDNumber = (Session("IDNumber")))
What I am trying to do is DELETE ALL Records with a certain ID
Number. This is my code:
<%
Option Explicit
Dim strConnect
%>
<!--#include file="adovbs.inc"-->
<!--#include file="DataStore.inc"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>EMPLOYEE MASTER DATABASE - DELETION</TITLE>
</HEAD>
<BODY BGCOLOR="FFFF80">
<CENTER>
<H1>DELETING EMPLOYEE SKILL RECORDS<BR>FROM MASTER DATABASE</H1>
</CENTER>
<CENTER>
<%
Response.Write "<B><H3><EM><U>ATTENTION:</U></EM></H3>"
Response.Write "<H4>AFTER YOU HAVE <U>DELETED THIS EMPLOYEE'S</U> <BR>"
Response.Write "INDIVIDUAL SKILL RECORDS FROM THE EMPLOYEE'S SKILLS TABLE
<BR>"
Response.Write "<U>THERE WILL BE NO REFERENCE'S OF THIS EMPLOYEE ANYWHERE
IN THIS DATABASE.</U></H4><BR> "
%>
</CENTER>
<%
Dim objRS, intNoOfRecords
Set objRs = Server.CreateObject("ADODB.Recordset")
objRS.Open "EmployeeSkillsTable", strConnect, adOpenStatic,
adLockOptimistic,adCmdTable
objRS.Filter = (IDNumber = (Session("IDNumber")))
Response.Write "We are DELETING ALL of the following records:<BR>"
While Not objRS.EOF
Response.Write (objRs("SkillID"))
Response.Write "<BR>"
objRS.Delete
objRS.MoveNext
Wend
objRS.Close
Response.Write "We have DELETED ALL REFERENCES TO "
Response.Write (Session("FirstName"))
Response.Write " "
Response.Write (Session("LastName"))
Response.Write " "
Response.Write "from the <STRONG>EMPLOYEE MASTER DATABASE.</STRONG>"
Set objComm = Nothing
%>
</BODY>
</HTML>
Also, where do I go to find out the meaning (explanation) of an error
without coming to the list?
Message #2 by "Li, Fang" <fang@c...> on Wed, 29 Nov 2000 18:04:50 -0500
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C05A58.C6ACD010
Content-Type: text/plain;
charset="iso-8859-1"
If you use "Option Explicit", you should define all of your variables.
try add: Dim IDNumber before use it. hope it works.
Fang
-----Original Message-----
From: Leo Clayton [mailto:claytonl@z...]
Sent: Wednesday, November 29, 2000 4:51 PM
To: ASP Databases
Subject: [asp_databases] Microsoft VBScript runtime error '800a01f4'
Can someone out there tell me why I got this error?
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'IDNumber'
/EmployeeMasterStuff/DeleteEmployeeSkillRecords.asp, line 37
This is line 37:
objRS.Filter = (IDNumber = (Session("IDNumber")))
What I am trying to do is DELETE ALL Records with a certain ID Number. This
is my code:
<%
Option Explicit
Dim strConnect
%>
<!--#include file="adovbs.inc"-->
<!--#include file="DataStore.inc"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>EMPLOYEE MASTER DATABASE - DELETION</TITLE>
</HEAD>
<BODY BGCOLOR="FFFF80">
<CENTER>
<H1>DELETING EMPLOYEE SKILL RECORDS<BR>FROM MASTER DATABASE</H1>
</CENTER>
<CENTER>
<%
Response.Write "<B><H3><EM><U>ATTENTION:</U></EM></H3>"
Response.Write "<H4>AFTER YOU HAVE <U>DELETED THIS EMPLOYEE'S</U> <BR>"
Response.Write "INDIVIDUAL SKILL RECORDS FROM THE EMPLOYEE'S SKILLS TABLE
<BR>"
Response.Write "<U>THERE WILL BE NO REFERENCE'S OF THIS EMPLOYEE ANYWHERE IN
THIS DATABASE.</U></H4><BR> "
%>
</CENTER>
<%
Dim objRS, intNoOfRecords
Set objRs = Server.CreateObject("ADODB.Recordset")
objRS.Open "EmployeeSkillsTable", strConnect, adOpenStatic,
adLockOptimistic,adCmdTable
objRS.Filter = (IDNumber = (Session("IDNumber")))
Response.Write "We are DELETING ALL of the following records:<BR>"
While Not objRS.EOF
Response.Write (objRs("SkillID"))
Response.Write "<BR>"
objRS.Delete
objRS.MoveNext
Wend
objRS.Close
Response.Write "We have DELETED ALL REFERENCES TO "
Response.Write (Session("FirstName"))
Response.Write " "
Response.Write (Session("LastName"))
Response.Write " "
Response.Write "from the <STRONG>EMPLOYEE MASTER DATABASE.</STRONG>"
Set objComm = Nothing
%>
</BODY>
</HTML>
Also, where do I go to find out the meaning (explanation) of an error
without coming to the list?
---
FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS
IN YOUR INBOX!
Get the latest and best HTML, XML, and JavaScript tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb's
FREE IT newsletters at http://www.earthweb.com today!
Message #3 by "Ken Schaefer" <ken@a...> on Thu, 30 Nov 2000 11:21:01 +1100
|
|
Where do you do
Dim IDNumber ' as integer
?
Now if you just want to delete all records with a certain ID number, do it
this way:
<%
strSQL = "DELETE FROM table1 "
strSQL = strSQL & "WHERE ID = " & intSomeIDNumber
objConn.execute strSQL,,adCmdText+adExecuteNoRecord
%>
which is much more efficient.
If you want to delete more than one ID number, use the IN keyword.
Cheers
Ken
----- Original Message -----
From: "Leo Clayton" <claytonl@z...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, November 30, 2000 8:50 AM
Subject: [asp_databases] Microsoft VBScript runtime error '800a01f4'
> Can someone out there tell me why I got this error?
> Microsoft VBScript runtime error '800a01f4'
>
> Variable is undefined: 'IDNumber'
>
> /EmployeeMasterStuff/DeleteEmployeeSkillRecords.asp, line 37
>
> This is line 37:
> objRS.Filter = (IDNumber = (Session("IDNumber")))
>
> What I am trying to do is DELETE ALL Records with a certain ID
> Number. This is my code:
> <%
> Option Explicit
> Dim strConnect
> %>
>
> <!--#include file="adovbs.inc"-->
> <!--#include file="DataStore.inc"-->
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
>
> <HTML>
> <HEAD>
> <TITLE>EMPLOYEE MASTER DATABASE - DELETION</TITLE>
> </HEAD>
>
> <BODY BGCOLOR="FFFF80">
> <CENTER>
> <H1>DELETING EMPLOYEE SKILL RECORDS<BR>FROM MASTER DATABASE</H1>
> </CENTER>
>
> <CENTER>
> <%
> Response.Write "<B><H3><EM><U>ATTENTION:</U></EM></H3>"
> Response.Write "<H4>AFTER YOU HAVE <U>DELETED THIS EMPLOYEE'S</U> <BR>"
> Response.Write "INDIVIDUAL SKILL RECORDS FROM THE EMPLOYEE'S SKILLS TABLE
> <BR>"
> Response.Write "<U>THERE WILL BE NO REFERENCE'S OF THIS EMPLOYEE ANYWHERE
> IN THIS DATABASE.</U></H4><BR> "
> %>
> </CENTER>
>
> <%
>
> Dim objRS, intNoOfRecords
> Set objRs = Server.CreateObject("ADODB.Recordset")
>
> objRS.Open "EmployeeSkillsTable", strConnect, adOpenStatic,
> adLockOptimistic,adCmdTable
>
> objRS.Filter = (IDNumber = (Session("IDNumber")))
> Response.Write "We are DELETING ALL of the following records:<BR>"
> While Not objRS.EOF
> Response.Write (objRs("SkillID"))
> Response.Write "<BR>"
> objRS.Delete
> objRS.MoveNext
> Wend
>
> objRS.Close
>
> Response.Write "We have DELETED ALL REFERENCES TO "
> Response.Write (Session("FirstName"))
> Response.Write " "
> Response.Write (Session("LastName"))
> Response.Write " "
> Response.Write "from the <STRONG>EMPLOYEE MASTER DATABASE.</STRONG>"
>
>
> Set objComm = Nothing
> %>
>
>
> </BODY>
> </HTML>
>
> Also, where do I go to find out the meaning (explanation) of an error
> without coming to the list?
>
>
>
>
Message #4 by Imar Spaanjaars <Imar@S...> on Thu, 30 Nov 2000 06:27:07 +0100
|
|
Hi Leo,
You are incorrectly passing the values for the filter property.
objRS.Filter = (IDNumber = (Session("IDNumber")))
is not a correct statement.
You are trying to pass a string to the Filter property, so do this instead:
objRS.Filter = ("IDNumber = " & Session("IDNumber"))
Suppose that Session("IDNumber") is 4 then the previous command will read:
objRS.Filter = ("IDNumber = 4")
HtH
Imar
At 04:50 PM 11/29/2000 -0500, you wrote:
>Can someone out there tell me why I got this error?
>Microsoft VBScript runtime error '800a01f4'
>
>Variable is undefined: 'IDNumber'
>
>/EmployeeMasterStuff/DeleteEmployeeSkillRecords.asp, line 37
>
>This is line 37:
>objRS.Filter = (IDNumber = (Session("IDNumber")))
>
>What I am trying to do is DELETE ALL Records with a certain ID
>Number. This is my code:
><%
>Option Explicit
>Dim strConnect
>%>
>
><!--#include file="adovbs.inc"-->
><!--#include file="DataStore.inc"-->
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
>
><HTML>
><HEAD>
><TITLE>EMPLOYEE MASTER DATABASE - DELETION</TITLE>
></HEAD>
>
><BODY BGCOLOR="FFFF80">
><CENTER>
><H1>DELETING EMPLOYEE SKILL RECORDS<BR>FROM MASTER DATABASE</H1>
></CENTER>
>
><CENTER>
><%
>Response.Write "<B><H3><EM><U>ATTENTION:</U></EM></H3>"
>Response.Write "<H4>AFTER YOU HAVE <U>DELETED THIS EMPLOYEE'S</U> <BR>"
>Response.Write "INDIVIDUAL SKILL RECORDS FROM THE EMPLOYEE'S SKILLS TABLE
><BR>"
>Response.Write "<U>THERE WILL BE NO REFERENCE'S OF THIS EMPLOYEE ANYWHERE
>IN THIS DATABASE.</U></H4><BR> "
>%>
></CENTER>
>
><%
>
>Dim objRS, intNoOfRecords
>Set objRs = Server.CreateObject("ADODB.Recordset")
>
>objRS.Open "EmployeeSkillsTable", strConnect, adOpenStatic,
>adLockOptimistic,adCmdTable
>
>objRS.Filter = (IDNumber = (Session("IDNumber")))
>Response.Write "We are DELETING ALL of the following records:<BR>"
>While Not objRS.EOF
> Response.Write (objRs("SkillID"))
> Response.Write "<BR>"
> objRS.Delete
> objRS.MoveNext
>Wend
>
>objRS.Close
>
>Response.Write "We have DELETED ALL REFERENCES TO "
>Response.Write (Session("FirstName"))
>Response.Write " "
>Response.Write (Session("LastName"))
>Response.Write " "
>Response.Write "from the <STRONG>EMPLOYEE MASTER DATABASE.</STRONG>"
>
>
>Set objComm = Nothing
>%>
>
></BODY>
></HTML>
>
>Also, where do I go to find out the meaning (explanation) of an error
>without coming to the list?
>
|
|
 |