|
 |
asp_databases thread: ADO DB Object closed error.
Message #1 by "Foust, Joshua R." <jfoust@N...> on Fri, 15 Sep 2000 09:58:53 -0400
|
|
Could someone help me with this? I'm trying to have the user type in a
certain value to be searched in an Access db, and then to have all the
entries with that value displayed. Here is the code I have so far:
<%
9 varSIC_Code = Request.Form("SIC_Codes")
10 Dim oRSiv
11 Set oRSiv = Server.CreateObject("ADODB.recordset")
12 sqlText="SELECT * FROM tblmaster"
13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
14 Do While NOT oRSiv.EOF
15 Response.Write oRSiv("SIC_Code") & "<BR>"
16 oRSiv.MoveNext
17 Loop
18 oRSiv.Close
19 Set oRSiv= Nothing
%>
and when I run this I get the following error (it baffles me):
ADODB.Recordset error '800a0e78'
The operation requested by the application is not allowed if the object is
closed.
/test_josh/neon/sic.asp, line 14
I marked the lines of code. Any help would be greatly appreciated!!!
-Josh
Message #2 by Chris Neale <Chris.Neale@s...> on Fri, 15 Sep 2000 16:34:49 +0100
|
|
You've set your oRSiv object to be an ADODB recordset, but you've not
actually used an Open method to open up the connection. At line 13b try
oRSiv.open(sqlText). Should help.
Chris
Chaos! Panic! Disaster! (My work here is done)
Chris Neale. Web/Wap Developer
Chris.neale@s... <mailto:Chris.neale@s...>
www.sparkresponse.co.uk
-----Original Message-----
From: Foust, Joshua R. [SMTP:jfoust@N...]
Sent: Friday, September 15, 2000 11:40 PM
To: ASP Databases
Subject: [asp_databases] ADO DB Object closed error.
Could someone help me with this? I'm trying to have the user type
in a
certain value to be searched in an Access db, and then to have all
the
entries with that value displayed. Here is the code I have so far:
<%
9 varSIC_Code = Request.Form("SIC_Codes")
10 Dim oRSiv
11 Set oRSiv = Server.CreateObject("ADODB.recordset")
12 sqlText="SELECT * FROM tblmaster"
13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
14 Do While NOT oRSiv.EOF
15 Response.Write oRSiv("SIC_Code") & "<BR>"
16 oRSiv.MoveNext
17 Loop
18 oRSiv.Close
19 Set oRSiv= Nothing
%>
and when I run this I get the following error (it baffles me):
ADODB.Recordset error '800a0e78'
The operation requested by the application is not allowed if the
object is
closed.
/test_josh/neon/sic.asp, line 14
I marked the lines of code. Any help would be greatly
appreciated!!!
-Josh
Message #3 by Imar Spaanjaars <Imar@S...> on Fri, 15 Sep 2000 17:33:16 +0200
|
|
Well, it's exactly what it says: you are doing something with a closed
recordset. You try to loop through it, without opening first.
Try this:
sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
oRSiv.Open sqlText, sYourConnectionStringOrOYourConnectionObject,
adOpenForwardOnly, aLockReadOnly, adCmdText
if not oRSiv.EOF ' check if the recordset contains records
Do While NOT oRSiv.EOF
' Do your stuff here
loop
end if
oRSiv.Close
Set oRSiv= Nothing
That should do the trick
Have a nice weekend
Imar
At 03:39 PM 9/15/2000 -0700, you wrote:
>Could someone help me with this? I'm trying to have the user type in a
>certain value to be searched in an Access db, and then to have all the
>entries with that value displayed. Here is the code I have so far:
>
> <%
>9 varSIC_Code = Request.Form("SIC_Codes")
>10 Dim oRSiv
>11 Set oRSiv = Server.CreateObject("ADODB.recordset")
>12 sqlText="SELECT * FROM tblmaster"
>13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
>14 Do While NOT oRSiv.EOF
>15 Response.Write oRSiv("SIC_Code") & "<BR>"
>16 oRSiv.MoveNext
>17 Loop
>18 oRSiv.Close
>19 Set oRSiv= Nothing
> %>
>
>and when I run this I get the following error (it baffles me):
>
>ADODB.Recordset error '800a0e78'
>The operation requested by the application is not allowed if the object is
>closed.
>/test_josh/neon/sic.asp, line 14
>I marked the lines of code. Any help would be greatly appreciated!!!
>-Josh
>
>
>
>
Message #4 by "David E" <registerukh@h...> on Fri, 15 Sep 2000 08:55:51 PDT
|
|
I think we are forgetting to open the recordset (oRSiv.open blah blah).
>From: "Foust, Joshua R." <jfoust@N...>
>Reply-To: "ASP Databases" <asp_databases@p...>
>To: "ASP Databases" <asp_databases@p...>
>Subject: [asp_databases] ADO DB Object closed error.
>Date: Fri, 15 Sep 2000 15:39:59 -0700
>
>Could someone help me with this? I'm trying to have the user type in a
>certain value to be searched in an Access db, and then to have all the
>entries with that value displayed. Here is the code I have so far:
>
> <%
>9 varSIC_Code = Request.Form("SIC_Codes")
>10 Dim oRSiv
>11 Set oRSiv = Server.CreateObject("ADODB.recordset")
>12 sqlText="SELECT * FROM tblmaster"
>13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
>14 Do While NOT oRSiv.EOF
>15 Response.Write oRSiv("SIC_Code") & "<BR>"
>16 oRSiv.MoveNext
>17 Loop
>18 oRSiv.Close
>19 Set oRSiv= Nothing
> %>
>
>and when I run this I get the following error (it baffles me):
>
>ADODB.Recordset error '800a0e78'
>The operation requested by the application is not allowed if the object is
>closed.
>/test_josh/neon/sic.asp, line 14
>I marked the lines of code. Any help would be greatly appreciated!!!
>-Josh
>
>
>
>
Message #5 by =?iso-8859-1?Q?Gonzalo_Ruiz_de_Villa_Su=E1rez?= <gonzalo.ruizdevilla@a...> on Fri, 15 Sep 2000 18:04:34 +0200
|
|
First you must connect to the database and then execute the sql sentence.
Then you will have a recordset...
<%
9 varSIC_Code = Request.Form("SIC_Codes")
10 Dim oRSiv
11 Set oRSiv = Server.CreateObject("ADODB.recordset")
12 sqlText="SELECT * FROM tblmaster"
13a sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
13b oRSiv.Open sqlText, "DSN=mytabledsn" ' You missed
this line
14 Do While NOT oRSiv.EOF
15 Response.Write oRSiv("SIC_Code") & "<BR>"
16 oRSiv.MoveNext
17 Loop
18 oRSiv.Close
19 Set oRSiv= Nothing
%>
Cheers,
Gonzalo
-----Mensaje original-----
De: Foust, Joshua R. [mailto:jfoust@N...]
Enviado el: sábado, 16 de septiembre de 2000 0:40
Para: ASP Databases
Asunto: [asp_databases] ADO DB Object closed error.
Could someone help me with this? I'm trying to have the user type in a
certain value to be searched in an Access db, and then to have all the
entries with that value displayed. Here is the code I have so far:
<%
9 varSIC_Code = Request.Form("SIC_Codes")
10 Dim oRSiv
11 Set oRSiv = Server.CreateObject("ADODB.recordset")
12 sqlText="SELECT * FROM tblmaster"
13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
14 Do While NOT oRSiv.EOF
15 Response.Write oRSiv("SIC_Code") & "<BR>"
16 oRSiv.MoveNext
17 Loop
18 oRSiv.Close
19 Set oRSiv= Nothing
%>
and when I run this I get the following error (it baffles me):
ADODB.Recordset error '800a0e78'
The operation requested by the application is not allowed if the object is
closed.
/test_josh/neon/sic.asp, line 14
I marked the lines of code. Any help would be greatly appreciated!!!
-Josh
Message #6 by wswyght@t... on Fri, 15 Sep 2000 17:37:17 GMT
|
|
PRB: Cannot Access a Stored Procedure's Return Value from DTC
ID: Q190762
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft Visual InterDev, version 6.0
--------------------------------------------------------------------------------
SYMPTOMS
A Recordset design-time control (DTC) is bound to a stored procedure, which
returns a value, but no recordset. When the return value is accessed, this error
occurs:
ADODB.Recordset error '800a0e78'
The operation requested by the application is not allowed if the object is closed.
/<Web name>/_ScriptLibrary/Recordset.ASP, line 762
CAUSE
The stored procedure must return a recordset in order for the Recordset DTC
to access the return value.
RESOLUTION
Create a DataEnvironment (DE) command.
Use the following code to access the return value of the data command:
set DE =3D server.createobject("DERuntime.DERuntime")
DE.init Application("DE")
Set cmd =3D DE.Commands("Command1")
Set ps =3D cmd.Parameters
' Uncomment the following lines to provide parameters
' for the stored procedure. Use appropriate values.
' ps(1) =3D param1
' ps(2) =3D param2
cmd.execute
retval =3D ps(0)
STATUS
This behavior is by design. The Recordset DTC was designed to work with recordsets.
MORE INFORMATION
Steps to Reproduce Behavior
Create a stored procedure that does not return a recordset, such as this:
Create Procedure JustReturns
As
return 23
Bind a recordset DTC to the stored procedure.
Try to access the return value of the stored procedure:
Response.Write "Return Value =3D ["
Response.Write Recordset1.getParameter( 0 )
Response.Write "]"
This produces an error:
ADODB.Recordset error '800a0e78'
The operation requested by the application is not allowed
if the object is closed.
/<Web name>/_ScriptLibrary/Recordset.ASP, line 762
Additional query words:
Keywords : kbASP kbCtrl kbVisID kbVisID600 kbGrpASP
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 24, 1999
=A9 2000 Microsoft Corporation. All rights reserved. Terms of Use.
--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.
>Could someone help me with this? I'm trying to have the user type in a
>certain value to be searched in an Access db, and then to have all the
>entries with that value displayed. Here is the code I have so far:
>
> <%
>9=09varSIC_Code =3D Request.Form("SIC_Codes")
>10=09Dim oRSiv
>11=09Set oRSiv =3D Server.CreateObject("ADODB.recordset")
>12=09sqlText=3D"SELECT * FROM tblmaster"
>13=09sqlText=3DsqlText & "WHERE SIC_Codes=3D" & varSIC_Code & " ; "
>14=09Do While NOT oRSiv.EOF
>15=09=09Response.Write oRSiv("SIC_Code") & "<BR>"
>16=09=09oRSiv.MoveNext
>17=09Loop
>18=09oRSiv.Close
>19=09Set oRSiv=3D Nothing
> %>
>
>and when I run this I get the following error (it baffles me):
>
>ADODB.Recordset error '800a0e78'
>The operation requested by the application is not allowed if the object is
>closed.
>/test_josh/neon/sic.asp, line 14
>I marked the lines of code. Any help would be greatly appreciated!!!
>-Josh
>
>
>
>
Message #7 by "Foust, Joshua R." <jfoust@N...> on Tue, 19 Sep 2000 10:50:20 -0400
|
|
well, here's the asp code as it stands now:
<%
varSIC_Code = Request.Form("SIC_Codes")
Dim oRSiv
Set oRSiv = Server.CreateObject("ADODB.recordset")
sqlText="SELECT * FROM tblmaster"
sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
oRSiv.Open sqlText, "DSN=neon"
adOpenForwardOnly, aLockReadOnly, adCmdText
if not oRSiv.EOF then
Do While NOT oRSiv.EOF
Response.Write oRSiv("SIC_Code") & "<BR>"
oRSiv.MoveNext
loop
end if
oRSiv.Close
Set oRSiv= Nothing
%>
and now I'm getting THIS error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
/test_josh/neon/sicexp.asp, line 14
what does it mean? Oh yeah, and thanks for the other part - that cleared up
at least some things!
-Josh
> -----Original Message-----
> From: Imar Spaanjaars [SMTP:Imar@S...]
> Sent: Friday, September 15, 2000 11:33 AM
> To: ASP Databases
> Subject: [asp_databases] Re: ADO DB Object closed error.
>
> Well, it's exactly what it says: you are doing something with a closed
> recordset. You try to loop through it, without opening first.
>
> Try this:
> sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> oRSiv.Open sqlText, sYourConnectionStringOrOYourConnectionObject,
> adOpenForwardOnly, aLockReadOnly, adCmdText
> if not oRSiv.EOF ' check if the recordset contains records
> Do While NOT oRSiv.EOF
> ' Do your stuff here
> loop
> end if
> oRSiv.Close
> Set oRSiv= Nothing
>
> That should do the trick
>
> Have a nice weekend
>
> Imar
>
> At 03:39 PM 9/15/2000 -0700, you wrote:
> >Could someone help me with this? I'm trying to have the user type in a
> >certain value to be searched in an Access db, and then to have all the
> >entries with that value displayed. Here is the code I have so far:
> >
> > <%
> >9 varSIC_Code = Request.Form("SIC_Codes")
> >10 Dim oRSiv
> >11 Set oRSiv = Server.CreateObject("ADODB.recordset")
> >12 sqlText="SELECT * FROM tblmaster"
> >13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> >14 Do While NOT oRSiv.EOF
> >15 Response.Write oRSiv("SIC_Code") & "<BR>"
> >16 oRSiv.MoveNext
> >17 Loop
> >18 oRSiv.Close
> >19 Set oRSiv= Nothing
> > %>
> >
> >and when I run this I get the following error (it baffles me):
> >
> >ADODB.Recordset error '800a0e78'
> >The operation requested by the application is not allowed if the object
> is
> >closed.
> >/test_josh/neon/sic.asp, line 14
> >I marked the lines of code. Any help would be greatly appreciated!!!
> >-Josh
> >
> >
> >
> >
>
>
> ---
> You are currently subscribed to asp_databases
> $subst('Email.Unsub')
Message #8 by Imar Spaanjaars <Imar@S...> on Tue, 19 Sep 2000 17:11:19 +0200
|
|
Hi,
First of all, try to change your "SELECT *" statement.
See Ken's website to find out why SELECT * is bad.
http://www.adopenstatic.com/FAQ/selectstarisbad.asp
Secondly, you should do a response.write of your SQL statement just before
you open it. Use this to debug the sql statement.
If you'd done that, you would have seen the following:
SELECT * FROM tblmasterWHERE SIC_Codes etc etc.
This doesn't make sense, since there is no table tblmasterWHERE
So add a space before the WHERE clause, like this:
sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
HtH
Imar
At 10:50 AM 9/19/2000 -0400, you wrote:
>well, here's the asp code as it stands now:
>
><%
> varSIC_Code = Request.Form("SIC_Codes")
> Dim oRSiv
> Set oRSiv = Server.CreateObject("ADODB.recordset")
> sqlText="SELECT * FROM tblmaster"
> sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> oRSiv.Open sqlText, "DSN=neon"
> adOpenForwardOnly, aLockReadOnly, adCmdText
> if not oRSiv.EOF then
> Do While NOT oRSiv.EOF
> Response.Write oRSiv("SIC_Code") & "<BR>"
> oRSiv.MoveNext
> loop
> end if
> oRSiv.Close
> Set oRSiv= Nothing
>%>
>
>and now I'm getting THIS error:
>
>Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
>[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
>/test_josh/neon/sicexp.asp, line 14
>
>
>what does it mean? Oh yeah, and thanks for the other part - that cleared up
>at least some things!
>
>-Josh
>
> > -----Original Message-----
> > From: Imar Spaanjaars [SMTP:Imar@S...]
> > Sent: Friday, September 15, 2000 11:33 AM
> > To: ASP Databases
> > Subject: [asp_databases] Re: ADO DB Object closed error.
> >
> > Well, it's exactly what it says: you are doing something with a closed
> > recordset. You try to loop through it, without opening first.
> >
> > Try this:
> > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > oRSiv.Open sqlText, sYourConnectionStringOrOYourConnectionObject,
> > adOpenForwardOnly, aLockReadOnly, adCmdText
> > if not oRSiv.EOF ' check if the recordset contains records
> > Do While NOT oRSiv.EOF
> > ' Do your stuff here
> > loop
> > end if
> > oRSiv.Close
> > Set oRSiv= Nothing
> >
> > That should do the trick
> >
> > Have a nice weekend
> >
> > Imar
> >
> > At 03:39 PM 9/15/2000 -0700, you wrote:
> > >Could someone help me with this? I'm trying to have the user type in a
> > >certain value to be searched in an Access db, and then to have all the
> > >entries with that value displayed. Here is the code I have so far:
> > >
> > > <%
> > >9 varSIC_Code = Request.Form("SIC_Codes")
> > >10 Dim oRSiv
> > >11 Set oRSiv = Server.CreateObject("ADODB.recordset")
> > >12 sqlText="SELECT * FROM tblmaster"
> > >13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > >14 Do While NOT oRSiv.EOF
> > >15 Response.Write oRSiv("SIC_Code") & "<BR>"
> > >16 oRSiv.MoveNext
> > >17 Loop
> > >18 oRSiv.Close
> > >19 Set oRSiv= Nothing
> > > %>
> > >
> > >and when I run this I get the following error (it baffles me):
> > >
> > >ADODB.Recordset error '800a0e78'
> > >The operation requested by the application is not allowed if the object
> > is
> > >closed.
> > >/test_josh/neon/sic.asp, line 14
> > >I marked the lines of code. Any help would be greatly appreciated!!!
> > >-Josh
> > >
> > >
> > >
> > >
Message #9 by "Foust, Joshua R." <jfoust@N...> on Tue, 19 Sep 2000 11:29:39 -0400
|
|
thanks - I did that, but now I have this error message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.
/test_josh/neon/sicexp.asp, line 14
here is everything again, with line 14 marked:
varSIC_Code = Request.Form("SIC_Codes")
Dim oRSiv
Set oRSiv = Server.CreateObject("ADODB.recordset")
sqlText="SELECT Company_Name FROM tblmaster"
sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
line 14 oRSiv.Open sqlText, "DSN=neon"
adOpenForwardOnly, aLockReadOnly, adCmdText
Do While NOT oRSiv.EOF
Response.Write oRSiv("SIC_Code") & "<BR>"
oRSiv.MoveNext
loop
oRSiv.Close
Set oRSiv= Nothing
Once again, thanks for the help
-Josh
> -----Original Message-----
> From: Imar Spaanjaars [SMTP:Imar@S...]
> Sent: Tuesday, September 19, 2000 11:11 AM
> To: ASP Databases
> Subject: [asp_databases] Re: ADO DB Object closed error.
>
> Hi,
>
> First of all, try to change your "SELECT *" statement.
> See Ken's website to find out why SELECT * is bad.
> http://www.adopenstatic.com/FAQ/selectstarisbad.asp
>
> Secondly, you should do a response.write of your SQL statement just before
>
> you open it. Use this to debug the sql statement.
>
> If you'd done that, you would have seen the following:
>
> SELECT * FROM tblmasterWHERE SIC_Codes etc etc.
>
> This doesn't make sense, since there is no table tblmasterWHERE
>
> So add a space before the WHERE clause, like this:
>
> sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
>
> HtH
>
> Imar
>
>
> At 10:50 AM 9/19/2000 -0400, you wrote:
> >well, here's the asp code as it stands now:
> >
> ><%
> > varSIC_Code = Request.Form("SIC_Codes")
> > Dim oRSiv
> > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > sqlText="SELECT * FROM tblmaster"
> > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > oRSiv.Open sqlText, "DSN=neon"
> > adOpenForwardOnly, aLockReadOnly, adCmdText
> > if not oRSiv.EOF then
> > Do While NOT oRSiv.EOF
> > Response.Write oRSiv("SIC_Code") & "<BR>"
> > oRSiv.MoveNext
> > loop
> > end if
> > oRSiv.Close
> > Set oRSiv= Nothing
> >%>
> >
> >and now I'm getting THIS error:
> >
> >Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
> >[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
> >/test_josh/neon/sicexp.asp, line 14
> >
> >
> >what does it mean? Oh yeah, and thanks for the other part - that cleared
> up
> >at least some things!
> >
> >-Josh
> >
> > > -----Original Message-----
> > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > Sent: Friday, September 15, 2000 11:33 AM
> > > To: ASP Databases
> > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > >
> > > Well, it's exactly what it says: you are doing something with a closed
> > > recordset. You try to loop through it, without opening first.
> > >
> > > Try this:
> > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > oRSiv.Open sqlText, sYourConnectionStringOrOYourConnectionObject,
> > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > if not oRSiv.EOF ' check if the recordset contains records
> > > Do While NOT oRSiv.EOF
> > > ' Do your stuff here
> > > loop
> > > end if
> > > oRSiv.Close
> > > Set oRSiv= Nothing
> > >
> > > That should do the trick
> > >
> > > Have a nice weekend
> > >
> > > Imar
> > >
> > > At 03:39 PM 9/15/2000 -0700, you wrote:
> > > >Could someone help me with this? I'm trying to have the user type in
> a
> > > >certain value to be searched in an Access db, and then to have all
> the
> > > >entries with that value displayed. Here is the code I have so far:
> > > >
> > > > <%
> > > >9 varSIC_Code = Request.Form("SIC_Codes")
> > > >10 Dim oRSiv
> > > >11 Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > >12 sqlText="SELECT * FROM tblmaster"
> > > >13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > >14 Do While NOT oRSiv.EOF
> > > >15 Response.Write oRSiv("SIC_Code") & "<BR>"
> > > >16 oRSiv.MoveNext
> > > >17 Loop
> > > >18 oRSiv.Close
> > > >19 Set oRSiv= Nothing
> > > > %>
> > > >
> > > >and when I run this I get the following error (it baffles me):
> > > >
> > > >ADODB.Recordset error '800a0e78'
> > > >The operation requested by the application is not allowed if the
> object
> > > is
> > > >closed.
> > > >/test_josh/neon/sic.asp, line 14
> > > >I marked the lines of code. Any help would be greatly appreciated!!!
> > > >-Josh
> > > >
> > > >
> > > >
> > > >
>
Message #10 by Imar Spaanjaars <Imar@S...> on Tue, 19 Sep 2000 18:20:09 +0200
|
|
What is the datatype of SIC_Codes?? If it is not a number, but a string for
instance, the varSIC_Code needs to be enclosed by 2 apostrophes.
Like this: WHERE SIC_Codes='" & varSIC_Code & "';"
Also make sure that varSIC_Code actually has a value. You can check that
by, once again, writing out the SQL statement just before you open the
recordset.
Getting closer.......
Imar
At 11:29 AM 9/19/2000 -0400, you wrote:
>thanks - I did that, but now I have this error message:
>
>Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
>[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
>expression.
>/test_josh/neon/sicexp.asp, line 14
>here is everything again, with line 14 marked:
>
> varSIC_Code = Request.Form("SIC_Codes")
> Dim oRSiv
> Set oRSiv = Server.CreateObject("ADODB.recordset")
> sqlText="SELECT Company_Name FROM tblmaster"
> sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
> line 14 oRSiv.Open sqlText, "DSN=neon"
> adOpenForwardOnly, aLockReadOnly, adCmdText
> Do While NOT oRSiv.EOF
> Response.Write oRSiv("SIC_Code") & "<BR>"
> oRSiv.MoveNext
> loop
> oRSiv.Close
> Set oRSiv= Nothing
>
>Once again, thanks for the help
>
>-Josh
>
> > -----Original Message-----
> > From: Imar Spaanjaars [SMTP:Imar@S...]
> > Sent: Tuesday, September 19, 2000 11:11 AM
> > To: ASP Databases
> > Subject: [asp_databases] Re: ADO DB Object closed error.
> >
> > Hi,
> >
> > First of all, try to change your "SELECT *" statement.
> > See Ken's website to find out why SELECT * is bad.
> > http://www.adopenstatic.com/FAQ/selectstarisbad.asp
> >
> > Secondly, you should do a response.write of your SQL statement just before
> >
> > you open it. Use this to debug the sql statement.
> >
> > If you'd done that, you would have seen the following:
> >
> > SELECT * FROM tblmasterWHERE SIC_Codes etc etc.
> >
> > This doesn't make sense, since there is no table tblmasterWHERE
> >
> > So add a space before the WHERE clause, like this:
> >
> > sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
> >
> > HtH
> >
> > Imar
> >
> >
> > At 10:50 AM 9/19/2000 -0400, you wrote:
> > >well, here's the asp code as it stands now:
> > >
> > ><%
> > > varSIC_Code = Request.Form("SIC_Codes")
> > > Dim oRSiv
> > > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > sqlText="SELECT * FROM tblmaster"
> > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > oRSiv.Open sqlText, "DSN=neon"
> > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > if not oRSiv.EOF then
> > > Do While NOT oRSiv.EOF
> > > Response.Write oRSiv("SIC_Code") & "<BR>"
> > > oRSiv.MoveNext
> > > loop
> > > end if
> > > oRSiv.Close
> > > Set oRSiv= Nothing
> > >%>
> > >
> > >and now I'm getting THIS error:
> > >
> > >Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
> > >[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
> > >/test_josh/neon/sicexp.asp, line 14
> > >
> > >
> > >what does it mean? Oh yeah, and thanks for the other part - that cleared
> > up
> > >at least some things!
> > >
> > >-Josh
> > >
> > > > -----Original Message-----
> > > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > > Sent: Friday, September 15, 2000 11:33 AM
> > > > To: ASP Databases
> > > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > > >
> > > > Well, it's exactly what it says: you are doing something with a closed
> > > > recordset. You try to loop through it, without opening first.
> > > >
> > > > Try this:
> > > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > > oRSiv.Open sqlText, sYourConnectionStringOrOYourConnectionObject,
> > > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > > if not oRSiv.EOF ' check if the recordset contains records
> > > > Do While NOT oRSiv.EOF
> > > > ' Do your stuff here
> > > > loop
> > > > end if
> > > > oRSiv.Close
> > > > Set oRSiv= Nothing
> > > >
> > > > That should do the trick
> > > >
> > > > Have a nice weekend
> > > >
> > > > Imar
> > > >
> > > > At 03:39 PM 9/15/2000 -0700, you wrote:
> > > > >Could someone help me with this? I'm trying to have the user type in
> > a
> > > > >certain value to be searched in an Access db, and then to have all
> > the
> > > > >entries with that value displayed. Here is the code I have so far:
> > > > >
> > > > > <%
> > > > >9 varSIC_Code = Request.Form("SIC_Codes")
> > > > >10 Dim oRSiv
> > > > >11 Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > > >12 sqlText="SELECT * FROM tblmaster"
> > > > >13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > > >14 Do While NOT oRSiv.EOF
> > > > >15 Response.Write oRSiv("SIC_Code") & "<BR>"
> > > > >16 oRSiv.MoveNext
> > > > >17 Loop
> > > > >18 oRSiv.Close
> > > > >19 Set oRSiv= Nothing
> > > > > %>
> > > > >
> > > > >and when I run this I get the following error (it baffles me):
> > > > >
> > > > >ADODB.Recordset error '800a0e78'
> > > > >The operation requested by the application is not allowed if the
> > object
> > > > is
> > > > >closed.
> > > > >/test_josh/neon/sic.asp, line 14
> > > > >I marked the lines of code. Any help would be greatly appreciated!!!
> > > > >-Josh
> > > > >
> > > > >
> > > > >
> > > > >
> >
Message #11 by "Foust, Joshua R." <jfoust@N...> on Tue, 19 Sep 2000 12:37:38 -0400
|
|
great - the extra quotes fixed that problem, but now it tells me I have a
type mismatch with "adOpenForwardOnly" - I'm not quite sure what exactly
this is or what it means, so any help....?
As far as making sure there is a value there - in some entries in the DB,
there are multiple, and in some, the sic code field is empty. Is this bad?
-Josh
> -----Original Message-----
> From: Imar Spaanjaars [SMTP:Imar@S...]
> Sent: Tuesday, September 19, 2000 12:20 PM
> To: ASP Databases
> Subject: [asp_databases] Re: ADO DB Object closed error.
>
> What is the datatype of SIC_Codes?? If it is not a number, but a string
> for
> instance, the varSIC_Code needs to be enclosed by 2 apostrophes.
>
> Like this: WHERE SIC_Codes='" & varSIC_Code & "';"
> Also make sure that varSIC_Code actually has a value. You can check that
> by, once again, writing out the SQL statement just before you open the
> recordset.
>
>
> Getting closer.......
>
>
>
> Imar
>
>
>
>
> At 11:29 AM 9/19/2000 -0400, you wrote:
> >thanks - I did that, but now I have this error message:
> >
> >Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
> >[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
> >expression.
> >/test_josh/neon/sicexp.asp, line 14
> >here is everything again, with line 14 marked:
> >
> > varSIC_Code = Request.Form("SIC_Codes")
> > Dim oRSiv
> > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > sqlText="SELECT Company_Name FROM tblmaster"
> > sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
> > line 14 oRSiv.Open sqlText, "DSN=neon"
> > adOpenForwardOnly, aLockReadOnly, adCmdText
> > Do While NOT oRSiv.EOF
> > Response.Write oRSiv("SIC_Code") & "<BR>"
> > oRSiv.MoveNext
> > loop
> > oRSiv.Close
> > Set oRSiv= Nothing
> >
> >Once again, thanks for the help
> >
> >-Josh
> >
> > > -----Original Message-----
> > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > Sent: Tuesday, September 19, 2000 11:11 AM
> > > To: ASP Databases
> > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > >
> > > Hi,
> > >
> > > First of all, try to change your "SELECT *" statement.
> > > See Ken's website to find out why SELECT * is bad.
> > > http://www.adopenstatic.com/FAQ/selectstarisbad.asp
> > >
> > > Secondly, you should do a response.write of your SQL statement just
> before
> > >
> > > you open it. Use this to debug the sql statement.
> > >
> > > If you'd done that, you would have seen the following:
> > >
> > > SELECT * FROM tblmasterWHERE SIC_Codes etc etc.
> > >
> > > This doesn't make sense, since there is no table tblmasterWHERE
> > >
> > > So add a space before the WHERE clause, like this:
> > >
> > > sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
> > >
> > > HtH
> > >
> > > Imar
> > >
> > >
> > > At 10:50 AM 9/19/2000 -0400, you wrote:
> > > >well, here's the asp code as it stands now:
> > > >
> > > ><%
> > > > varSIC_Code = Request.Form("SIC_Codes")
> > > > Dim oRSiv
> > > > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > > sqlText="SELECT * FROM tblmaster"
> > > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > > oRSiv.Open sqlText, "DSN=neon"
> > > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > > if not oRSiv.EOF then
> > > > Do While NOT oRSiv.EOF
> > > > Response.Write oRSiv("SIC_Code") & "<BR>"
> > > > oRSiv.MoveNext
> > > > loop
> > > > end if
> > > > oRSiv.Close
> > > > Set oRSiv= Nothing
> > > >%>
> > > >
> > > >and now I'm getting THIS error:
> > > >
> > > >Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
> > > >[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM
> clause.
> > > >/test_josh/neon/sicexp.asp, line 14
> > > >
> > > >
> > > >what does it mean? Oh yeah, and thanks for the other part - that
> cleared
> > > up
> > > >at least some things!
> > > >
> > > >-Josh
> > > >
> > > > > -----Original Message-----
> > > > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > > > Sent: Friday, September 15, 2000 11:33 AM
> > > > > To: ASP Databases
> > > > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > > > >
> > > > > Well, it's exactly what it says: you are doing something with a
> closed
> > > > > recordset. You try to loop through it, without opening first.
> > > > >
> > > > > Try this:
> > > > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > > > oRSiv.Open sqlText, sYourConnectionStringOrOYourConnectionObject,
> > > > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > > > if not oRSiv.EOF ' check if the recordset contains records
> > > > > Do While NOT oRSiv.EOF
> > > > > ' Do your stuff here
> > > > > loop
> > > > > end if
> > > > > oRSiv.Close
> > > > > Set oRSiv= Nothing
> > > > >
> > > > > That should do the trick
> > > > >
> > > > > Have a nice weekend
> > > > >
> > > > > Imar
> > > > >
> > > > > At 03:39 PM 9/15/2000 -0700, you wrote:
> > > > > >Could someone help me with this? I'm trying to have the user
> type in
> > > a
> > > > > >certain value to be searched in an Access db, and then to have
> all
> > > the
> > > > > >entries with that value displayed. Here is the code I have so
> far:
> > > > > >
> > > > > > <%
> > > > > >9 varSIC_Code = Request.Form("SIC_Codes")
> > > > > >10 Dim oRSiv
> > > > > >11 Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > > > >12 sqlText="SELECT * FROM tblmaster"
> > > > > >13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ;
> "
> > > > > >14 Do While NOT oRSiv.EOF
> > > > > >15 Response.Write oRSiv("SIC_Code") & "<BR>"
> > > > > >16 oRSiv.MoveNext
> > > > > >17 Loop
> > > > > >18 oRSiv.Close
> > > > > >19 Set oRSiv= Nothing
> > > > > > %>
> > > > > >
> > > > > >and when I run this I get the following error (it baffles me):
> > > > > >
> > > > > >ADODB.Recordset error '800a0e78'
> > > > > >The operation requested by the application is not allowed if the
> > > object
> > > > > is
> > > > > >closed.
> > > > > >/test_josh/neon/sic.asp, line 14
> > > > > >I marked the lines of code. Any help would be greatly
> appreciated!!!
> > > > > >-Josh
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > >
Message #12 by ckoski@w... on Tue, 19 Sep 2000 16:44:36 -0400
|
|
you'll need to include the file adovbs.inc in your page at the beginning (do
a find on your computer and it will show up... copy it into the web project
and voila...)
Cory Koski
Web Programmer
Wabang Creative Technology and TBSource.com
e-certified as Master ASP programmer, Web programmer,
and IIS 4.0 Administrator
visit: http://www.tbsource.com/
(xxx) xxx-xxxx ext. 41
----- Original Message -----
From: "Foust, Joshua R." <jfoust@N...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, September 19, 2000 12:37 PM
Subject: [asp_databases] Re: ADO DB Object closed error.
> great - the extra quotes fixed that problem, but now it tells me I have a
> type mismatch with "adOpenForwardOnly" - I'm not quite sure what exactly
> this is or what it means, so any help....?
>
> As far as making sure there is a value there - in some entries in the DB,
> there are multiple, and in some, the sic code field is empty. Is this
bad?
>
> -Josh
>
> > -----Original Message-----
> > From: Imar Spaanjaars [SMTP:Imar@S...]
> > Sent: Tuesday, September 19, 2000 12:20 PM
> > To: ASP Databases
> > Subject: [asp_databases] Re: ADO DB Object closed error.
> >
> > What is the datatype of SIC_Codes?? If it is not a number, but a string
> > for
> > instance, the varSIC_Code needs to be enclosed by 2 apostrophes.
> >
> > Like this: WHERE SIC_Codes='" & varSIC_Code & "';"
> > Also make sure that varSIC_Code actually has a value. You can check that
> > by, once again, writing out the SQL statement just before you open the
> > recordset.
> >
> >
> > Getting closer.......
> >
> >
> >
> > Imar
> >
> >
> >
> >
> > At 11:29 AM 9/19/2000 -0400, you wrote:
> > >thanks - I did that, but now I have this error message:
> > >
> > >Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
> > >[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in
criteria
> > >expression.
> > >/test_josh/neon/sicexp.asp, line 14
> > >here is everything again, with line 14 marked:
> > >
> > > varSIC_Code = Request.Form("SIC_Codes")
> > > Dim oRSiv
> > > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > sqlText="SELECT Company_Name FROM tblmaster"
> > > sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > line 14 oRSiv.Open sqlText, "DSN=neon"
> > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > Do While NOT oRSiv.EOF
> > > Response.Write oRSiv("SIC_Code") & "<BR>"
> > > oRSiv.MoveNext
> > > loop
> > > oRSiv.Close
> > > Set oRSiv= Nothing
> > >
> > >Once again, thanks for the help
> > >
> > >-Josh
> > >
> > > > -----Original Message-----
> > > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > > Sent: Tuesday, September 19, 2000 11:11 AM
> > > > To: ASP Databases
> > > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > > >
> > > > Hi,
> > > >
> > > > First of all, try to change your "SELECT *" statement.
> > > > See Ken's website to find out why SELECT * is bad.
> > > > http://www.adopenstatic.com/FAQ/selectstarisbad.asp
> > > >
> > > > Secondly, you should do a response.write of your SQL statement just
> > before
> > > >
> > > > you open it. Use this to debug the sql statement.
> > > >
> > > > If you'd done that, you would have seen the following:
> > > >
> > > > SELECT * FROM tblmasterWHERE SIC_Codes etc etc.
> > > >
> > > > This doesn't make sense, since there is no table tblmasterWHERE
> > > >
> > > > So add a space before the WHERE clause, like this:
> > > >
> > > > sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > >
> > > > HtH
> > > >
> > > > Imar
> > > >
> > > >
> > > > At 10:50 AM 9/19/2000 -0400, you wrote:
> > > > >well, here's the asp code as it stands now:
> > > > >
> > > > ><%
> > > > > varSIC_Code = Request.Form("SIC_Codes")
> > > > > Dim oRSiv
> > > > > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > > > sqlText="SELECT * FROM tblmaster"
> > > > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > > > oRSiv.Open sqlText, "DSN=neon"
> > > > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > > > if not oRSiv.EOF then
> > > > > Do While NOT oRSiv.EOF
> > > > > Response.Write oRSiv("SIC_Code") & "<BR>"
> > > > > oRSiv.MoveNext
> > > > > loop
> > > > > end if
> > > > > oRSiv.Close
> > > > > Set oRSiv= Nothing
> > > > >%>
> > > > >
> > > > >and now I'm getting THIS error:
> > > > >
> > > > >Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
> > > > >[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM
> > clause.
> > > > >/test_josh/neon/sicexp.asp, line 14
> > > > >
> > > > >
> > > > >what does it mean? Oh yeah, and thanks for the other part - that
> > cleared
> > > > up
> > > > >at least some things!
> > > > >
> > > > >-Josh
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > > > > Sent: Friday, September 15, 2000 11:33 AM
> > > > > > To: ASP Databases
> > > > > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > > > > >
> > > > > > Well, it's exactly what it says: you are doing something with a
> > closed
> > > > > > recordset. You try to loop through it, without opening first.
> > > > > >
> > > > > > Try this:
> > > > > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > > > > oRSiv.Open sqlText,
sYourConnectionStringOrOYourConnectionObject,
> > > > > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > > > > if not oRSiv.EOF ' check if the recordset contains records
> > > > > > Do While NOT oRSiv.EOF
> > > > > > ' Do your stuff here
> > > > > > loop
> > > > > > end if
> > > > > > oRSiv.Close
> > > > > > Set oRSiv= Nothing
> > > > > >
> > > > > > That should do the trick
> > > > > >
> > > > > > Have a nice weekend
> > > > > >
> > > > > > Imar
> > > > > >
> > > > > > At 03:39 PM 9/15/2000 -0700, you wrote:
> > > > > > >Could someone help me with this? I'm trying to have the user
> > type in
> > > > a
> > > > > > >certain value to be searched in an Access db, and then to have
> > all
> > > > the
> > > > > > >entries with that value displayed. Here is the code I have so
> > far:
> > > > > > >
> > > > > > > <%
> > > > > > >9 varSIC_Code = Request.Form("SIC_Codes")
> > > > > > >10 Dim oRSiv
> > > > > > >11 Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > > > > >12 sqlText="SELECT * FROM tblmaster"
> > > > > > >13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & "
;
> > "
> > > > > > >14 Do While NOT oRSiv.EOF
> > > > > > >15 Response.Write oRSiv("SIC_Code") & "<BR>"
> > > > > > >16 oRSiv.MoveNext
> > > > > > >17 Loop
> > > > > > >18 oRSiv.Close
> > > > > > >19 Set oRSiv= Nothing
> > > > > > > %>
> > > > > > >
> > > > > > >and when I run this I get the following error (it baffles me):
> > > > > > >
> > > > > > >ADODB.Recordset error '800a0e78'
> > > > > > >The operation requested by the application is not allowed if
the
> > > > object
> > > > > > is
> > > > > > >closed.
> > > > > > >/test_josh/neon/sic.asp, line 14
> > > > > > >I marked the lines of code. Any help would be greatly
> > appreciated!!!
> > > > > > >-Josh
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > >
>
>
Message #13 by Imar Spaanjaars <Imar@S...> on Tue, 19 Sep 2000 21:57:11 +0200
|
|
This is truly a "one step at the time" problem. The best thing you could
have done is lookup a "data-connection stuff for beginners at
www.asptoday.com or at www.4guysfromrolla.com.
Anyway, adOpenForwardOnly is a constant (representing the value 0). This
constan6t can be used in the following 4 ways (maybe more, who knows).
IMHO, the third and last are preferred.
1. Don't us the constant, but the value, like this: oRSiv.Open sqlText,
"DSN=neon" 0, 1
This doesn't make your code very readable.
2. Declare them yourself: Const adOpenForwardOnly = 0
Not recommended either, cause you have to do this on every page you use the
constant, or include your own file.
3. Include the adovbs.inc file, (found in Program Files\Common
Files\System\Ado by default) with this code (copy it to your virtual root,
or modify the statement:
<!--#include virtual="/adovbs.inc"-->
4. Add a reference to the ADO dll in your global.asa. For this to work, you
need to know the exact location of the DLL which can be a problem if you
use an ISP or can't / don't use the global.asa.
However, imo this is the recommend way, because all constants are included
directly from the source. If anything ever changes, there's no risk you
have an old include file:
<!--METADATA TYPE="typelib"
FILE="D:\Program Files\Common Files\SYSTEM\ADO\msado15.dll"
NAME="ADODB Type Library" -->
Modify the above path to match your location of msado15.dll
I hope this will help, and solve your problem. I can hardly think of
anything more to go wrong....... ;-) (Well, you could have problems
with your DSN........, in that case, check
out: http://www.adopenstatic.com/FAQ/OLEDBConnection.asp and
http://www.adopenstatic.com/FAQ/whyOLEDB.asp from Ken's site.)
About your sic_code: a value is not required in the database. But if you do
a select, the value is needed in Request.Form("SIC_Codes")
You can't say: SELECT bla1, bla2 from tblBla Where varSIC_Code
This will return an error.
If you have a valid varSIC_Code (SELECT bla1, bla2 from tblBla Where
varSIC_Code = 'Blabla' for instance) only records matching the varSIC_Code
will be returned. If multiple records are returned, that's OK as well.
After all, you use the do while not.EOF loop to read every record in the
recordset. This won't return records where the varSIC_Code is NULL (empty).
Imar
At 12:37 PM 9/19/2000 -0400, you wrote:
>great - the extra quotes fixed that problem, but now it tells me I have a
>type mismatch with "adOpenForwardOnly" - I'm not quite sure what exactly
>this is or what it means, so any help....?
>
>As far as making sure there is a value there - in some entries in the DB,
>there are multiple, and in some, the sic code field is empty. Is this bad?
>
>-Josh
>
> > -----Original Message-----
> > From: Imar Spaanjaars [SMTP:Imar@S...]
> > Sent: Tuesday, September 19, 2000 12:20 PM
> > To: ASP Databases
> > Subject: [asp_databases] Re: ADO DB Object closed error.
> >
> > What is the datatype of SIC_Codes?? If it is not a number, but a string
> > for
> > instance, the varSIC_Code needs to be enclosed by 2 apostrophes.
> >
> > Like this: WHERE SIC_Codes='" & varSIC_Code & "';"
> > Also make sure that varSIC_Code actually has a value. You can check that
> > by, once again, writing out the SQL statement just before you open the
> > recordset.
> >
> >
> > Getting closer.......
> >
> >
> >
> > Imar
> >
Message #14 by "Dana Coffey" <dcoffey@x...> on Wed, 20 Sep 2000 02:10:29 -0400
|
|
we bad we bad we bad!!
Talk to you soon!
d
Dana Coffey
Technologist, Xceed, Inc.
112 Krog St. Atlanta, GA 30307
tel. xxx-xxx-xxxx x 5013
www.xceed.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Everything should be as simple as it is, but not simpler.
----Albert Einstein
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----Original Message-----
From: Foust, Joshua R. [mailto:jfoust@N...]
Sent: Tuesday, September 19, 2000 10:50 AM
To: ASP Databases
Subject: [asp_databases] Re: ADO DB Object closed error.
well, here's the asp code as it stands now:
<%
varSIC_Code = Request.Form("SIC_Codes")
Dim oRSiv
Set oRSiv = Server.CreateObject("ADODB.recordset")
sqlText="SELECT * FROM tblmaster"
sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
oRSiv.Open sqlText, "DSN=neon"
adOpenForwardOnly, aLockReadOnly, adCmdText
if not oRSiv.EOF then
Do While NOT oRSiv.EOF
Response.Write oRSiv("SIC_Code") & "<BR>"
oRSiv.MoveNext
loop
end if
oRSiv.Close
Set oRSiv= Nothing
%>
and now I'm getting THIS error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
/test_josh/neon/sicexp.asp, line 14
what does it mean? Oh yeah, and thanks for the other part - that cleared up
at least some things!
-Josh
> -----Original Message-----
> From: Imar Spaanjaars [SMTP:Imar@S...]
> Sent: Friday, September 15, 2000 11:33 AM
> To: ASP Databases
> Subject: [asp_databases] Re: ADO DB Object closed error.
>
> Well, it's exactly what it says: you are doing something with a closed
> recordset. You try to loop through it, without opening first.
>
> Try this:
> sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> oRSiv.Open sqlText, sYourConnectionStringOrOYourConnectionObject,
> adOpenForwardOnly, aLockReadOnly, adCmdText
> if not oRSiv.EOF ' check if the recordset contains records
> Do While NOT oRSiv.EOF
> ' Do your stuff here
> loop
> end if
> oRSiv.Close
> Set oRSiv= Nothing
>
> That should do the trick
>
> Have a nice weekend
>
> Imar
>
> At 03:39 PM 9/15/2000 -0700, you wrote:
> >Could someone help me with this? I'm trying to have the user type in a
> >certain value to be searched in an Access db, and then to have all the
> >entries with that value displayed. Here is the code I have so far:
> >
> > <%
> >9 varSIC_Code = Request.Form("SIC_Codes")
> >10 Dim oRSiv
> >11 Set oRSiv = Server.CreateObject("ADODB.recordset")
> >12 sqlText="SELECT * FROM tblmaster"
> >13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> >14 Do While NOT oRSiv.EOF
> >15 Response.Write oRSiv("SIC_Code") & "<BR>"
> >16 oRSiv.MoveNext
> >17 Loop
> >18 oRSiv.Close
> >19 Set oRSiv= Nothing
> > %>
> >
> >and when I run this I get the following error (it baffles me):
> >
> >ADODB.Recordset error '800a0e78'
> >The operation requested by the application is not allowed if the object
> is
> >closed.
> >/test_josh/neon/sic.asp, line 14
> >I marked the lines of code. Any help would be greatly appreciated!!!
> >-Josh
> >
> >
> >
> >
>
>
Message #15 by "Piotrowski, Sebastian" <Sebastian.Piotrowski@a...> on Wed, 20 Sep 2000 09:52:29 +1000
|
|
Content-Type: text/plain;
charset="ISO-8859-1"
to use the constant adOpenforwardOnly make sure you have included it
somewhere in your page before you use it
ie "CONST adOpenForwardOnly = 0"
Microsoft have created a file that includes all the constants used by ado,
it's normally called "adovbs.inc"
somwhere on your development box (%systemDrive%:\program files\common\ado)
you should have a copy of it
-----Original Message-----
From: Foust, Joshua R. [mailto:jfoust@N...]
Sent: Wednesday, 20 September 2000 02:38
To: ASP Databases
Subject: [asp_databases] Re: ADO DB Object closed error.
great - the extra quotes fixed that problem, but now it tells me I have a
type mismatch with "adOpenForwardOnly" - I'm not quite sure what exactly
this is or what it means, so any help....?
As far as making sure there is a value there - in some entries in the DB,
there are multiple, and in some, the sic code field is empty. Is this bad?
-Josh
> -----Original Message-----
> From: Imar Spaanjaars [SMTP:Imar@S...]
> Sent: Tuesday, September 19, 2000 12:20 PM
> To: ASP Databases
> Subject: [asp_databases] Re: ADO DB Object closed error.
>
> What is the datatype of SIC_Codes?? If it is not a number, but a string
> for
> instance, the varSIC_Code needs to be enclosed by 2 apostrophes.
>
> Like this: WHERE SIC_Codes='" & varSIC_Code & "';"
> Also make sure that varSIC_Code actually has a value. You can check that
> by, once again, writing out the SQL statement just before you open the
> recordset.
>
>
> Getting closer.......
>
>
>
> Imar
>
>
>
>
> At 11:29 AM 9/19/2000 -0400, you wrote:
> >thanks - I did that, but now I have this error message:
> >
> >Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
> >[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
> >expression.
> >/test_josh/neon/sicexp.asp, line 14
> >here is everything again, with line 14 marked:
> >
> > varSIC_Code = Request.Form("SIC_Codes")
> > Dim oRSiv
> > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > sqlText="SELECT Company_Name FROM tblmaster"
> > sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
> > line 14 oRSiv.Open sqlText, "DSN=neon"
> > adOpenForwardOnly, aLockReadOnly, adCmdText
> > Do While NOT oRSiv.EOF
> > Response.Write oRSiv("SIC_Code") & "<BR>"
> > oRSiv.MoveNext
> > loop
> > oRSiv.Close
> > Set oRSiv= Nothing
> >
> >Once again, thanks for the help
> >
> >-Josh
> >
> > > -----Original Message-----
> > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > Sent: Tuesday, September 19, 2000 11:11 AM
> > > To: ASP Databases
> > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > >
> > > Hi,
> > >
> > > First of all, try to change your "SELECT *" statement.
> > > See Ken's website to find out why SELECT * is bad.
> > > http://www.adopenstatic.com/FAQ/selectstarisbad.asp
> > >
> > > Secondly, you should do a response.write of your SQL statement just
> before
> > >
> > > you open it. Use this to debug the sql statement.
> > >
> > > If you'd done that, you would have seen the following:
> > >
> > > SELECT * FROM tblmasterWHERE SIC_Codes etc etc.
> > >
> > > This doesn't make sense, since there is no table tblmasterWHERE
> > >
> > > So add a space before the WHERE clause, like this:
> > >
> > > sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
> > >
> > > HtH
> > >
> > > Imar
> > >
> > >
> > > At 10:50 AM 9/19/2000 -0400, you wrote:
> > > >well, here's the asp code as it stands now:
> > > >
> > > ><%
> > > > varSIC_Code = Request.Form("SIC_Codes")
> > > > Dim oRSiv
> > > > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > > sqlText="SELECT * FROM tblmaster"
> > > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > > oRSiv.Open sqlText, "DSN=neon"
> > > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > > if not oRSiv.EOF then
> > > > Do While NOT oRSiv.EOF
> > > > Response.Write oRSiv("SIC_Code") & "<BR>"
> > > > oRSiv.MoveNext
> > > > loop
> > > > end if
> > > > oRSiv.Close
> > > > Set oRSiv= Nothing
> > > >%>
> > > >
> > > >and now I'm getting THIS error:
> > > >
> > > >Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
> > > >[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM
> clause.
> > > >/test_josh/neon/sicexp.asp, line 14
> > > >
> > > >
> > > >what does it mean? Oh yeah, and thanks for the other part - that
> cleared
> > > up
> > > >at least some things!
> > > >
> > > >-Josh
> > > >
> > > > > -----Original Message-----
> > > > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > > > Sent: Friday, September 15, 2000 11:33 AM
> > > > > To: ASP Databases
> > > > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > > > >
> > > > > Well, it's exactly what it says: you are doing something with a
> closed
> > > > > recordset. You try to loop through it, without opening first.
> > > > >
> > > > > Try this:
> > > > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > > > oRSiv.Open sqlText, sYourConnectionStringOrOYourConnectionObject,
> > > > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > > > if not oRSiv.EOF ' check if the recordset contains records
> > > > > Do While NOT oRSiv.EOF
> > > > > ' Do your stuff here
> > > > > loop
> > > > > end if
> > > > > oRSiv.Close
> > > > > Set oRSiv= Nothing
> > > > >
> > > > > That should do the trick
> > > > >
> > > > > Have a nice weekend
> > > > >
> > > > > Imar
> > > > >
> > > > > At 03:39 PM 9/15/2000 -0700, you wrote:
> > > > > >Could someone help me with this? I'm trying to have the user
> type in
> > > a
> > > > > >certain value to be searched in an Access db, and then to have
> all
> > > the
> > > > > >entries with that value displayed. Here is the code I have so
> far:
> > > > > >
> > > > > > <%
> > > > > >9 varSIC_Code = Request.Form("SIC_Codes")
> > > > > >10 Dim oRSiv
> > > > > >11 Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > > > >12 sqlText="SELECT * FROM tblmaster"
> > > > > >13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ;
> "
> > > > > >14 Do While NOT oRSiv.EOF
> > > > > >15 Response.Write oRSiv("SIC_Code") & "<BR>"
> > > > > >16 oRSiv.MoveNext
> > > > > >17 Loop
> > > > > >18 oRSiv.Close
> > > > > >19 Set oRSiv= Nothing
> > > > > > %>
> > > > > >
> > > > > >and when I run this I get the following error (it baffles me):
> > > > > >
> > > > > >ADODB.Recordset error '800a0e78'
> > > > > >The operation requested by the application is not allowed if the
> > > object
> > > > > is
> > > > > >closed.
> > > > > >/test_josh/neon/sic.asp, line 14
> > > > > >I marked the lines of code. Any help would be greatly
> appreciated!!!
> > > > > >-Josh
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > >
Message #16 by "Foust, Joshua R." <jfoust@N...> on Wed, 20 Sep 2000 09:59:02 -0400
|
|
I included it, and the error is the same - it doesn't like adOpenForwardOnly
for some reason
> -----Original Message-----
> From: ckoski@w... [SMTP:ckoski@w...]
> Sent: Tuesday, September 19, 2000 4:45 PM
> To: ASP Databases
> Subject: [asp_databases] Re: ADO DB Object closed error.
>
> you'll need to include the file adovbs.inc in your page at the beginning
> (do
> a find on your computer and it will show up... copy it into the web
> project
> and voila...)
>
>
> Cory Koski
>
> Web Programmer
> Wabang Creative Technology and TBSource.com
> e-certified as Master ASP programmer, Web programmer,
> and IIS 4.0 Administrator
> visit: http://www.tbsource.com/
> (xxx) xxx-xxxx ext. 41
>
> ----- Original Message -----
> From: "Foust, Joshua R." <jfoust@N...>
> To: "ASP Databases" <asp_databases@p...>
> Sent: Tuesday, September 19, 2000 12:37 PM
> Subject: [asp_databases] Re: ADO DB Object closed error.
>
>
> > great - the extra quotes fixed that problem, but now it tells me I have
> a
> > type mismatch with "adOpenForwardOnly" - I'm not quite sure what exactly
> > this is or what it means, so any help....?
> >
> > As far as making sure there is a value there - in some entries in the
> DB,
> > there are multiple, and in some, the sic code field is empty. Is this
> bad?
> >
> > -Josh
> >
> > > -----Original Message-----
> > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > Sent: Tuesday, September 19, 2000 12:20 PM
> > > To: ASP Databases
> > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > >
> > > What is the datatype of SIC_Codes?? If it is not a number, but a
> string
> > > for
> > > instance, the varSIC_Code needs to be enclosed by 2 apostrophes.
> > >
> > > Like this: WHERE SIC_Codes='" & varSIC_Code & "';"
> > > Also make sure that varSIC_Code actually has a value. You can check
> that
> > > by, once again, writing out the SQL statement just before you open the
> > > recordset.
> > >
> > >
> > > Getting closer.......
> > >
> > >
> > >
> > > Imar
> > >
> > >
> > >
> > >
> > > At 11:29 AM 9/19/2000 -0400, you wrote:
> > > >thanks - I did that, but now I have this error message:
> > > >
> > > >Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
> > > >[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in
> criteria
> > > >expression.
> > > >/test_josh/neon/sicexp.asp, line 14
> > > >here is everything again, with line 14 marked:
> > > >
> > > > varSIC_Code = Request.Form("SIC_Codes")
> > > > Dim oRSiv
> > > > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > > sqlText="SELECT Company_Name FROM tblmaster"
> > > > sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > > line 14 oRSiv.Open sqlText, "DSN=neon"
> > > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > > Do While NOT oRSiv.EOF
> > > > Response.Write oRSiv("SIC_Code") & "<BR>"
> > > > oRSiv.MoveNext
> > > > loop
> > > > oRSiv.Close
> > > > Set oRSiv= Nothing
> > > >
> > > >Once again, thanks for the help
> > > >
> > > >-Josh
> > > >
> > > > > -----Original Message-----
> > > > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > > > Sent: Tuesday, September 19, 2000 11:11 AM
> > > > > To: ASP Databases
> > > > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > > > >
> > > > > Hi,
> > > > >
> > > > > First of all, try to change your "SELECT *" statement.
> > > > > See Ken's website to find out why SELECT * is bad.
> > > > > http://www.adopenstatic.com/FAQ/selectstarisbad.asp
> > > > >
> > > > > Secondly, you should do a response.write of your SQL statement
> just
> > > before
> > > > >
> > > > > you open it. Use this to debug the sql statement.
> > > > >
> > > > > If you'd done that, you would have seen the following:
> > > > >
> > > > > SELECT * FROM tblmasterWHERE SIC_Codes etc etc.
> > > > >
> > > > > This doesn't make sense, since there is no table tblmasterWHERE
> > > > >
> > > > > So add a space before the WHERE clause, like this:
> > > > >
> > > > > sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ;
> "
> > > > >
> > > > > HtH
> > > > >
> > > > > Imar
> > > > >
> > > > >
> > > > > At 10:50 AM 9/19/2000 -0400, you wrote:
> > > > > >well, here's the asp code as it stands now:
> > > > > >
> > > > > ><%
> > > > > > varSIC_Code = Request.Form("SIC_Codes")
> > > > > > Dim oRSiv
> > > > > > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > > > > sqlText="SELECT * FROM tblmaster"
> > > > > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ;
> "
> > > > > > oRSiv.Open sqlText, "DSN=neon"
> > > > > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > > > > if not oRSiv.EOF then
> > > > > > Do While NOT oRSiv.EOF
> > > > > > Response.Write oRSiv("SIC_Code") &
> "<BR>"
> > > > > > oRSiv.MoveNext
> > > > > > loop
> > > > > > end if
> > > > > > oRSiv.Close
> > > > > > Set oRSiv= Nothing
> > > > > >%>
> > > > > >
> > > > > >and now I'm getting THIS error:
> > > > > >
> > > > > >Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
> > > > > >[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM
> > > clause.
> > > > > >/test_josh/neon/sicexp.asp, line 14
> > > > > >
> > > > > >
> > > > > >what does it mean? Oh yeah, and thanks for the other part - that
> > > cleared
> > > > > up
> > > > > >at least some things!
> > > > > >
> > > > > >-Josh
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Imar Spaanjaars [SMTP:Imar@S...]
> > > > > > > Sent: Friday, September 15, 2000 11:33 AM
> > > > > > > To: ASP Databases
> > > > > > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > > > > > >
> > > > > > > Well, it's exactly what it says: you are doing something with
> a
> > > closed
> > > > > > > recordset. You try to loop through it, without opening first.
> > > > > > >
> > > > > > > Try this:
> > > > > > > sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > > > > > oRSiv.Open sqlText,
> sYourConnectionStringOrOYourConnectionObject,
> > > > > > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > > > > > if not oRSiv.EOF ' check if the recordset contains records
> > > > > > > Do While NOT oRSiv.EOF
> > > > > > > ' Do your stuff here
> > > > > > > loop
> > > > > > > end if
> > > > > > > oRSiv.Close
> > > > > > > Set oRSiv= Nothing
> > > > > > >
> > > > > > > That should do the trick
> > > > > > >
> > > > > > > Have a nice weekend
> > > > > > >
> > > > > > > Imar
> > > > > > >
>
> > > > > > > At 03:39 PM 9/15/2000 -0700, you wrote:
> > > > > > > >Could someone help me with this? I'm trying to have the user
> > > type in
> > > > > a
> > > > > > > >certain value to be searched in an Access db, and then to
> have
> > > all
> > > > > the
> > > > > > > >entries with that value displayed. Here is the code I have
> so
> > > far:
> > > > > > > >
> > > > > > > > <%
> > > > > > > >9 varSIC_Code = Request.Form("SIC_Codes")
> > > > > > > >10 Dim oRSiv
> > > > > > > >11 Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > > > > > >12 sqlText="SELECT * FROM tblmaster"
> > > > > > > >13 sqlText=sqlText & "WHERE SIC_Codes=" & varSIC_Code &
> "
> ;
> > > "
> > > > > > > >14 Do While NOT oRSiv.EOF
> > > > > > > >15 Response.Write oRSiv("SIC_Code") & "<BR>"
> > > > > > > >16 oRSiv.MoveNext
> > > > > > > >17 Loop
> > > > > > > >18 oRSiv.Close
> > > > > > > >19 Set oRSiv= Nothing
> > > > > > > > %>
> > > > > > > >
> > > > > > > >and when I run this I get the following error (it baffles
> me):
> > > > > > > >
> > > > > > > >ADODB.Recordset error '800a0e78'
> > > > > > > >The operation requested by the application is not allowed if
> the
> > > > > object
> > > > > > > is
> > > > > > > >closed.
> > > > > > > >/test_josh/neon/sic.asp, line 14
> > > > > > > >I marked the lines of code. Any help would be greatly
> > > appreciated!!!
> > > > > > > >-Josh
> > > > > > > >
> > > > > > > >
> > >
Message #17 by Imar Spaanjaars <Imar@S...> on Wed, 20 Sep 2000 21:52:22 +0200
|
|
How did you include it??
Can you paste some source here?? It should work when you include either the
whole file or just the Const.
Imar
At 09:59 AM 9/20/2000 -0400, you wrote:
>I included it, and the error is the same - it doesn't like adOpenForwardOnly
>for some reason
>
> > -----Original Message-----
> > From: ckoski@w... [SMTP:ckoski@w...]
> > Sent: Tuesday, September 19, 2000 4:45 PM
> > To: ASP Databases
> > Subject: [asp_databases] Re: ADO DB Object closed error.
> >
> > you'll need to include the file adovbs.inc in your page at the beginning
> > (do
> > a find on your computer and it will show up... copy it into the web
> > project
> > and voila...)
> >
Message #18 by "Foust, Joshua R." <jfoust@N...> on Wed, 20 Sep 2000 16:55:45 -0400
|
|
<%
varSIC_Code = Request.Form("SIC_Codes")
Dim oRSiv
Set oRSiv = Server.CreateObject("ADODB.recordset")
sqlText="SELECT Company_Name FROM tblmaster"
sqlText=sqlText & " WHERE SIC_Codes='" & varSIC_Code & "' ; "
CONST adOpenForwardOnly = 0
oRSiv.Open sqlText, "DSN=neon"
Do While NOT oRSiv.EOF
Response.Write oRSiv("SIC_Code") & "<BR>"
oRSiv.MoveNext
loop
oRSiv.Close
Set oRSiv= Nothing
%>
> -----Original Message-----
> From: Imar Spaanjaars [SMTP:Imar@S...]
> Sent: Wednesday, September 20, 2000 3:52 PM
> To: ASP Databases
> Subject: [asp_databases] Re: ADO DB Object closed error.
>
> How did you include it??
> Can you paste some source here?? It should work when you include either
> the
> whole file or just the Const.
>
> Imar
>
>
> At 09:59 AM 9/20/2000 -0400, you wrote:
> >I included it, and the error is the same - it doesn't like
> adOpenForwardOnly
> >for some reason
> >
> > > -----Original Message-----
> > > From: ckoski@w... [SMTP:ckoski@w...]
> > > Sent: Tuesday, September 19, 2000 4:45 PM
> > > To: ASP Databases
> > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > >
> > > you'll need to include the file adovbs.inc in your page at the
> beginning
> > > (do
> > > a find on your computer and it will show up... copy it into the web
> > > project
> > > and voila...)
> > >
>
>
Message #19 by ckoski@w... on Wed, 20 Sep 2000 17:08:13 -0400
|
|
ok before you do this, copy the Program Files\Common
Files\System\Ado\adovbs.inc file into your web project...
then add this code to your ASP page...
<!--#include virtual="/adovbs.inc"-->
That's it...
good luck
----- Original Message -----
From: "Imar Spaanjaars" <Imar@S...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, September 20, 2000 3:52 PM
Subject: [asp_databases] Re: ADO DB Object closed error.
> How did you include it??
> Can you paste some source here?? It should work when you include either
the
> whole file or just the Const.
>
> Imar
>
>
> At 09:59 AM 9/20/2000 -0400, you wrote:
> >I included it, and the error is the same - it doesn't like
adOpenForwardOnly
> >for some reason
> >
> > > -----Original Message-----
> > > From: ckoski@w... [SMTP:ckoski@w...]
> > > Sent: Tuesday, September 19, 2000 4:45 PM
> > > To: ASP Databases
> > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > >
> > > you'll need to include the file adovbs.inc in your page at the
beginning
> > > (do
> > > a find on your computer and it will show up... copy it into the web
> > > project
> > > and voila...)
> > >
>
>
Message #20 by "Foust, Joshua R." <jfoust@N...> on Wed, 20 Sep 2000 17:10:01 -0400
|
|
I've done that, and it is still not recognized...I posted what I did trying
to initialize adopenforwardonly by itself, to the same effect....
> -----Original Message-----
> From: ckoski@w... [SMTP:ckoski@w...]
> Sent: Wednesday, September 20, 2000 5:08 PM
> To: ASP Databases
> Subject: [asp_databases] Re: ADO DB Object closed error.
>
> ok before you do this, copy the Program Files\Common
> Files\System\Ado\adovbs.inc file into your web project...
>
> then add this code to your ASP page...
>
> <!--#include virtual="/adovbs.inc"-->
>
>
> That's it...
>
> good luck
>
> ----- Original Message -----
> From: "Imar Spaanjaars" <Imar@S...>
> To: "ASP Databases" <asp_databases@p...>
> Sent: Wednesday, September 20, 2000 3:52 PM
> Subject: [asp_databases] Re: ADO DB Object closed error.
>
>
> > How did you include it??
> > Can you paste some source here?? It should work when you include either
> the
> > whole file or just the Const.
> >
> > Imar
> >
> >
> > At 09:59 AM 9/20/2000 -0400, you wrote:
> > >I included it, and the error is the same - it doesn't like
> adOpenForwardOnly
> > >for some reason
> > >
> > > > -----Original Message-----
> > > > From: ckoski@w... [SMTP:ckoski@w...]
> > > > Sent: Tuesday, September 19, 2000 4:45 PM
> > > > To: ASP Databases
> > > > Subject: [asp_databases] Re: ADO DB Object closed error.
> > > >
> > > > you'll need to include the file adovbs.inc in your page at the
> beginning
> > > > (do
> > > > a find on your computer and it will show up... copy it into the web
> > > > project
> > > > and voila...)
> > > >
> >
> >
>
>
Message #21 by Imar Spaanjaars <Imar@S...> on Wed, 20 Sep 2000 23:25:10 +0200
|
|
Hmmmm, weird.
In the code below, you are no longer using adOpenForwardOnly, so how can it
generate an error?? What exactly is going wrong??
Is it the DSN after all??? ;-) Hope not.
Better check Ken's site and start using OLEDB
(http://www.adopenstatic.com/FAQ/OLEDBConnection.asp)
Imar
At 04:55 PM 9/20/2000 -0400, you wrote:
><%
> varSIC_Code = Request.Form("SIC_Codes")
> Dim oRSiv
> Set oRSiv = Server.CreateObject("ADODB.recordset")
> sqlText="SELECT Company_Name FROM tblmaster"
> sqlText=sqlText & " WHERE SIC_Codes='" & varSIC_Code & "' ; "
> CONST adOpenForwardOnly = 0
> oRSiv.Open sqlText, "DSN=neon"
> Do While NOT oRSiv.EOF
> Response.Write oRSiv("SIC_Code") & "<BR>"
> oRSiv.MoveNext
> loop
> oRSiv.Close
> Set oRSiv= Nothing
>%>
Message #22 by "Ken Schaefer" <ken@a...> on Thu, 21 Sep 2000 14:21:32 +1000
|
|
The reason why you are getting the type-mismatch error is because you are
missing a ,
<snip>
>> oRSiv.Open sqlText, "DSN=neon" adOpenForwardOnly, aLockReadOnly,
adCmdText
</snip>
There is *no* comma between "DSN=neon" and adOpenForwardOnly, which means
that ADO thinks that adOpenForwardOnly is part of the connection string. The
probable reason no one picked up on this is because the above was always
wrapped onto two separate lines in your other posts.
Once you've put the comma in, you'll start running into the 800a0bb9 -
constants are undefined, out of acceptable range, or in conflict with one
another error.
See http://www.adopenstatic.com/faq/800a0bb9step2.asp for ways on defining
the constants (eg including the adovbs.inc file)
Next, in a subsequent post, you showed us this code:
<snip>
<%
varSIC_Code = Request.Form("SIC_Codes")
Dim oRSiv
Set oRSiv = Server.CreateObject("ADODB.recordset")
sqlText="SELECT Company_Name FROM tblmaster"
sqlText=sqlText & " WHERE SIC_Codes='" & varSIC_Code & "' ; "
CONST adOpenForwardOnly = 0
oRSiv.Open sqlText, "DSN=neon"
Do While NOT oRSiv.EOF
Response.Write oRSiv("SIC_Code") & "<BR>"
oRSiv.MoveNext
loop
oRSiv.Close
Set oRSiv= Nothing
%>
</snip>
This will cause problems because you are doing this:
Response.Write oRSiv("SIC_Code")
but you didn't select SIC_Code in your original select statement. You can't
write out a field if you didn't select it to start off with! (you only
selected Company_Name in your SQL statement)
HTH
Cheers
Ken
----- Original Message -----
From: "Foust, Joshua R." <jfoust@N...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, September 20, 2000 2:37 AM
Subject: [asp_databases] Re: ADO DB Object closed error.
> great - the extra quotes fixed that problem, but now it tells me I have a
> type mismatch with "adOpenForwardOnly" - I'm not quite sure what exactly
> this is or what it means, so any help....?
>
> As far as making sure there is a value there - in some entries in the DB,
> there are multiple, and in some, the sic code field is empty. Is this
bad?
>
> -Josh
>
> > At 11:29 AM 9/19/2000 -0400, you wrote:
> > >thanks - I did that, but now I have this error message:
> > >
> > >Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
> > >[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in
criteria
> > >expression.
> > >/test_josh/neon/sicexp.asp, line 14
> > >here is everything again, with line 14 marked:
> > >
> > > varSIC_Code = Request.Form("SIC_Codes")
> > > Dim oRSiv
> > > Set oRSiv = Server.CreateObject("ADODB.recordset")
> > > sqlText="SELECT Company_Name FROM tblmaster"
> > > sqlText=sqlText & " WHERE SIC_Codes=" & varSIC_Code & " ; "
> > > line 14 oRSiv.Open sqlText, "DSN=neon"
> > > adOpenForwardOnly, aLockReadOnly, adCmdText
> > > Do While NOT oRSiv.EOF
> > > Response.Write oRSiv("SIC_Code") & "<BR>"
> > > oRSiv.MoveNext
> > > loop
> > > oRSiv.Close
> > > Set oRSiv= Nothing
> > >
> > >Once again, thanks for the help
> > >
> > >-Josh
Message #23 by Imar Spaanjaars <Imar@S...> on Thu, 21 Sep 2000 09:01:55 +0200
|
|
Ffffew, pretty sharp....... :-)
We all must have been sleeping except for you.
Imar
At 02:21 PM 9/21/2000 +1000, you wrote:
>The reason why you are getting the type-mismatch error is because you are
>missing a ,
>
><snip>
> >> oRSiv.Open sqlText, "DSN=neon" adOpenForwardOnly, aLockReadOnly,
>adCmdText
></snip>
>
>There is *no* comma between "DSN=neon" and adOpenForwardOnly, which means
>that ADO thinks that adOpenForwardOnly is part of the connection string. The
>probable reason no one picked up on this is because the above was always
>wrapped onto two separate lines in your other posts.
|
|
 |