|
 |
access_asp thread: help with Access,ASP code
Message #1 by "nask" <nask1@h...> on Sun, 22 Sep 2002 08:10:02
|
|
Hi,
I started learning ASP a couple days ago and i am running into a problem
when i try to run a objC.Open command. I am including some sample code
here - see if something looks odd thats causing the problem.
dim objCn,objRS
set objCn = Server.CreateObject("ADODB.Connection")
set objRS = Server.CreateObject("ADODB.Recordset")
dim strConnect
strConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"DataSource=c:\program files\microsoft
office\office\samples\Northwind.mdb;" & _
"Persist Security Info=false"
objCn.Open strConnect
objRS.Open "Categories"
...
Program breaks at objCn.Open statement. What could be wrong? I verified
the path that it matches with what i have in the code. Also i checked the
Error count - its 0.
Thanks in advance for the help
Message #2 by "nask" <nask1@h...> on Mon, 23 Sep 2002 01:50:49
|
|
> Hi,
> I started learning ASP a couple days ago and i am running into a
problem
w> hen i try to run a objC.Open command. I am including some sample code
h> ere - see if something looks odd thats causing the problem.
> dim objCn,objRS
s> et objCn = Server.CreateObject("ADODB.Connection")
s> et objRS = Server.CreateObject("ADODB.Recordset")
> dim strConnect
s> trConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "DataSource=c:\program files\microsoft
o> ffice\office\samples\Northwind.mdb;" & _
> "Persist Security Info=false"
o> bjCn.Open strConnect
o> bjRS.Open "Categories"
.> ..
> Program breaks at objCn.Open statement. What could be wrong? I verified
t> he path that it matches with what i have in the code. Also i checked
the
Error count - its 0.
Thanks in advance for the help
forgot to include the error description i get when i ran the above
program -
Error Type:
ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either
closed or invalid in this context.
thanks for any help
Message #3 by "Ken Schaefer" <ken@a...> on Mon, 23 Sep 2002 11:04:45 +1000
|
|
Your count is off. The error line is *not* objCN.Open. This can be verified
by look at the source of the error message (ADODB.Recordset (0x800A0E7D))
I suspect that the error is being thrown by the next line:
objRS.Open "categories"
When you .Open a recordset object you need to specify a connection object
(or string):
objRS.Open "categories", objConn
This tells the recordset where it's supposed to be getting the data from.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "nask" <nask1@h...>
Subject: [access_asp] Re: help with Access,ASP code
: > Hi,
:
: > I started learning ASP a couple days ago and i am running into a
: problem
: w> hen i try to run a objC.Open command. I am including some sample code
: h> ere - see if something looks odd thats causing the problem.
:
: > dim objCn,objRS
: s> et objCn = Server.CreateObject("ADODB.Connection")
: s> et objRS = Server.CreateObject("ADODB.Recordset")
:
: > dim strConnect
: s> trConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
: > "DataSource=c:\program files\microsoft
: o> ffice\office\samples\Northwind.mdb;" & _
: > "Persist Security Info=false"
: o> bjCn.Open strConnect
: o> bjRS.Open "Categories"
: .> ..
:
: > Program breaks at objCn.Open statement. What could be wrong? I verified
: t> he path that it matches with what i have in the code. Also i checked
: the
: Error count - its 0.
:
: Thanks in advance for the help
:
: forgot to include the error description i get when i ran the above
: program -
: Error Type:
: ADODB.Recordset (0x800A0E7D)
: The connection cannot be used to perform this operation. It is either
: closed or invalid in this context.
Message #4 by syed moiz <sa_moiz@y...> on Sun, 22 Sep 2002 22:12:45 -0700 (PDT)
|
|
hai,
try out this
objCN.Open (strConnect)
hope it works for u.
bye
--- nask <nask1@h...> wrote:
> Hi,
>
> I started learning ASP a couple days ago and i am
> running into a problem
> when i try to run a objC.Open command. I am
> including some sample code
> here - see if something looks odd thats causing the
> problem.
>
> dim objCn,objRS
> set objCn = Server.CreateObject("ADODB.Connection")
> set objRS = Server.CreateObject("ADODB.Recordset")
>
> dim strConnect
> strConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "DataSource=c:\program files\microsoft
>
> office\office\samples\Northwind.mdb;" & _
> "Persist Security Info=false"
> objCn.Open strConnect
> objRS.Open "Categories"
> ...
>
> Program breaks at objCn.Open statement. What could
> be wrong? I verified
> the path that it matches with what i have in the
> code. Also i checked the
> Error count - its 0.
>
> Thanks in advance for the help
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
Message #5 by "Michael Cell" <cellpulch@r...> on Wed, 25 Sep 2002 10:22:51 -0400
|
|
Look at the first line for explicit diming
From the Desk of Michael Cell
-----Original Message-----
From: nask [mailto:nask1@h...]
Sent: Sunday, September 22, 2002 8:10 AM
Subject: help with Access,ASP code
Hi,
I started learning ASP a couple days ago and i am running into a problem
when i try to run a objC.Open command. I am including some sample code
here - see if something looks odd thats causing the problem.
dim objCn,objRS 'This line looks a little troublesome
set objCn = Server.CreateObject("ADODB.Connection")
set objRS = Server.CreateObject("ADODB.Recordset")
dim strConnect
strConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"DataSource=c:\program files\microsoft
office\office\samples\Northwind.mdb;" & _
"Persist Security Info=false"
objCn.Open strConnect
objRS.Open "Categories"
...
Program breaks at objCn.Open statement. What could be wrong? I verified
the path that it matches with what i have in the code. Also i checked the
Error count - its 0.
Thanks in advance for the help
Message #6 by syed moiz <sa_moiz@y...> on Fri, 27 Sep 2002 22:30:30 -0700 (PDT)
|
|
hai,
u have the error on this line.
> objRS.Open "Categories"
it must be
objRS.Open "Categories",Objcn
try this out.
hope this works fine.
bye
--- Michael Cell <cellpulch@r...> wrote:
> Look at the first line for explicit diming
>
> From the Desk of Michael Cell
>
> -----Original Message-----
> From: nask [mailto:nask1@h...]
> Sent: Sunday, September 22, 2002 8:10 AM
> Subject: help with Access,ASP code
>
> Hi,
>
> I started learning ASP a couple days ago and i am
> running into a problem
> when i try to run a objC.Open command. I am
> including some sample code
> here - see if something looks odd thats causing the
> problem.
>
> dim objCn,objRS 'This line looks a little
> troublesome
> set objCn = Server.CreateObject("ADODB.Connection")
> set objRS = Server.CreateObject("ADODB.Recordset")
>
> dim strConnect
> strConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "DataSource=c:\program files\microsoft
> office\office\samples\Northwind.mdb;" & _
> "Persist Security Info=false"
> objCn.Open strConnect
> objRS.Open "Categories"
> ...
>
> Program breaks at objCn.Open statement. What could
> be wrong? I verified
> the path that it matches with what i have in the
> code. Also i checked the
> Error count - its 0.
>
> Thanks in advance for the help
>
>
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
|
|
 |