Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_database_setup thread: ASP connection string to Access


Message #1 by atifds9@h... on Sun, 14 Oct 2001 14:15:38
Hi all

I'm developing an ASP application for my final year project and i'm having 

trouble getting the ConnectionString to work here is the code and the 

error report and help is greatfully recived from a frustrated newbie.



<%@ Language=VBScript %>

<%Option Explicit%>

<!- - #include file="adovbs.inc" - ->



<%

Dim Connect, Constr, Record, FamilyName, FirstName, DOB, AERecNum, 

HosRecNum, TraNetNum

	

Set Connect = Server.CreateObject("ADODB.Connection")



Connect.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data 

Source=C:\Inetpub\wwwroot\DCF1.mdb"



Connect.Open



Set Record = Server.CreateObject("ADODB.Recordset")

Record.Open



Record.AddNew

Record("Family Name") = Request("FamilyName")

Record("First Name") = Request("FirstName")

Record("Date Of Birth") = Request("DOB")

Record("A&E Record No") = Request("AERecNum")

Record("Hospital Record No") = Request("HosRecNum")

Record("Trauma Network No") = Request("TraNetNum")

Record.Update

%>



Error Type:

ADODB.Recordset (0x800A0E7D)

The connection cannot be used to perform this operation. It is either 

closed or invalid in this context.

/TMP5aip3l75r8.asp, line 15







Message #2 by "Ken Schaefer" <ken@a...> on Mon, 15 Oct 2001 11:59:48 +1000
When you open a recordet object you need to tell it:



a) what you want to open (eg a table, the results of a query etc)

b) what connection to use



see;

http://www.adopenstatic.com/faq/800a0bb9.asp#RecordsetOpenSyntax

for the syntax for the .Open method of the Recordset object



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: <atifds9@h...>

Subject: [asp_database_setup] ASP connection string to Access





: I'm developing an ASP application for my final year project and i'm having

: trouble getting the ConnectionString to work here is the code and the

: error report and help is greatfully recived from a frustrated newbie.

:

: <%@ Language=VBScript %>

: <%Option Explicit%>

: <!- - #include file="adovbs.inc" - ->

:

: <%

: Dim Connect, Constr, Record, FamilyName, FirstName, DOB, AERecNum,

: HosRecNum, TraNetNum

:

: Set Connect = Server.CreateObject("ADODB.Connection")

:

: Connect.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data

: Source=C:\Inetpub\wwwroot\DCF1.mdb"

:

: Connect.Open

:

: Set Record = Server.CreateObject("ADODB.Recordset")

: Record.Open

:

: Record.AddNew

: Record("Family Name") = Request("FamilyName")

: Record("First Name") = Request("FirstName")

: Record("Date Of Birth") = Request("DOB")

: Record("A&E Record No") = Request("AERecNum")

: Record("Hospital Record No") = Request("HosRecNum")

: Record("Trauma Network No") = Request("TraNetNum")

: Record.Update

: %>

:

: Error Type:

: ADODB.Recordset (0x800A0E7D)

: The connection cannot be used to perform this operation. It is either

: closed or invalid in this context.

: /TMP5aip3l75r8.asp, line 15



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Message #3 by "Peter Scribner" <plscribner@w...> on Sun, 14 Oct 2001 15:28:05 -0400
See if this helps any:



www.wipschedule.com/p2pExample1.htm



peter





Message #4 by "David Yee" <david@r...> on Mon, 15 Oct 2001 11:02:51 +0800
You have missed out your SQL statement and connection object for your

Recordset.

Therefore your recordset is not yet open.



Record.Open strSQL,  connect, 3, 3, 1







----- Original Message -----

From: <atifds9@h...>

To: "ASP Database Setup" <asp_database_setup@p...>

Sent: Sunday, October 14, 2001 2:15 PM

Subject: [asp_database_setup] ASP connection string to Access





> Hi all

> I'm developing an ASP application for my final year project and i'm having

> trouble getting the ConnectionString to work here is the code and the

> error report and help is greatfully recived from a frustrated newbie.

>

> <%@ Language=VBScript %>

> <%Option Explicit%>

> <!- - #include file="adovbs.inc" - ->

>

> <%

> Dim Connect, Constr, Record, FamilyName, FirstName, DOB, AERecNum,

> HosRecNum, TraNetNum

>

> Set Connect = Server.CreateObject("ADODB.Connection")

>

> Connect.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data

> Source=C:\Inetpub\wwwroot\DCF1.mdb"

>

> Connect.Open

>

> Set Record = Server.CreateObject("ADODB.Recordset")

> Record.Open

>

> Record.AddNew

> Record("Family Name") = Request("FamilyName")

> Record("First Name") = Request("FirstName")

> Record("Date Of Birth") = Request("DOB")

> Record("A&E Record No") = Request("AERecNum")

> Record("Hospital Record No") = Request("HosRecNum")

> Record("Trauma Network No") = Request("TraNetNum")

> Record.Update

> %>

>

> Error Type:

> ADODB.Recordset (0x800A0E7D)

> The connection cannot be used to perform this operation. It is either

> closed or invalid in this context.

> /TMP5aip3l75r8.asp, line 15

>

>

Message #5 by "Drew, Ron" <RDrew@B...> on Mon, 15 Oct 2001 13:37:02 -0400
Stay away from possible reserved words...also put obj or xx or whatever you

want that would insure you not using a reserved word such as Connect or

Record



set objConn = Server.CreateObject("ADODB.Connection")

objConn.open "Provider=Microsoft.Jet.OLEDB.4.0;" & _

            "Data Source=c:\InetPub\wwwroot\xxx.mdb;" & _

            "User Id=admin;" & _

            "Password=;" 

set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open "yourtable",objConn,adOpenForwardOnly,adLockOptimistic,adCmdTable



-----Original Message-----

From: atifds9@h... [mailto:atifds9@h...] 

Sent: Sunday, October 14, 2001 10:16 AM

To: ASP Database Setup

Subject: [asp_database_setup] ASP connection string to Access



Hi all

I'm developing an ASP application for my final year project and i'm having 

trouble getting the ConnectionString to work here is the code and the 

error report and help is greatfully recived from a frustrated newbie.



<%@ Language=VBScript %>

<%Option Explicit%>

<!- - #include file="adovbs.inc" - ->



<%

Dim Connect, Constr, Record, FamilyName, FirstName, DOB, AERecNum, 

HosRecNum, TraNetNum

	

Set Connect = Server.CreateObject("ADODB.Connection")



Connect.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data 

Source=C:\Inetpub\wwwroot\DCF1.mdb"



Connect.Open



Set Record = Server.CreateObject("ADODB.Recordset")

Record.Open



Record.AddNew

Record("Family Name") = Request("FamilyName")

Record("First Name") = Request("FirstName")

Record("Date Of Birth") = Request("DOB")

Record("A&E Record No") = Request("AERecNum")

Record("Hospital Record No") = Request("HosRecNum")

Record("Trauma Network No") = Request("TraNetNum")

Record.Update

%>



Error Type:

ADODB.Recordset (0x800A0E7D)

The connection cannot be used to perform this operation. It is either 

closed or invalid in this context.

/TMP5aip3l75r8.asp, line 15
Message #6 by "jabron rafique" <jabronrafique@h...> on Wed, 17 Oct 2001 01:04:09 +0500
Hello! nice to get the help from me. Thanks.

You have a wrong thing in your code that is you had placed your .mdb file

 in your PWS directory. Trying again by puting your saved database outsid

e of www rout directory. Thanks.

Jibran Rafique



----- Original Message -----

From: atifds9@h...

Sent: Sunday, October 14, 2001 7:41 PM

To: ASP Database Setup

Subject: [asp_database_setup] ASP connection string to Access



Hi all

I'm developing an ASP application for my final year project and i'm havin

g

trouble getting the ConnectionString to work here is the code and the

error report and help is greatfully recived from a frustrated newbie.



<%@ Language=3DVBScript %>

<%Option Explicit%>

<!- - #include file=3D"adovbs.inc" - ->



<%

Dim Connect, Constr, Record, FamilyName, FirstName, DOB, AERecNum,

HosRecNum, TraNetNum



Set Connect =3D Server.CreateObject("ADODB.Connection")



Connect.ConnectionString =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;" & "Dat

a

Source=3DC:\Inetpub\wwwroot\DCF1.mdb"



Connect.Open



Set Record =3D Server.CreateObject("ADODB.Recordset")

Record.Open



Record.AddNew

Record("Family Name") =3D Request("FamilyName")

Record("First Name") =3D Request("FirstName")

Record("Date Of Birth") =3D Request("DOB")

Record("A&E Record No") =3D Request("AERecNum")

Record("Hospital Record No") =3D Request("HosRecNum")

Record("Trauma Network No") =3D Request("TraNetNum")

Record.Update

%>



Error Type:

ADODB.Recordset (0x800A0E7D)

The connection cannot be used to perform this operation. It is either

closed or invalid in this context.

/TMP5aip3l75r8.asp, line 15



Message #7 by "Drew, Ron" <RDrew@B...> on Tue, 16 Oct 2001 17:07:50 -0400
You are correct that the mdb is in the wwwroot directory which is bad.  You

can have the mdb under wwwroot but in its own directory like..

C:\Inetpub\wwwroot\database\DCF1.mdb

Then make sure the database directory/database is not read only..I have not

checked your code yet, but try that first as protection is a start.



-----Original Message-----

From: jabron rafique [mailto:jabronrafique@h...] 

Sent: Tuesday, October 16, 2001 4:04 PM

To: ASP Database Setup

Subject: [asp_database_setup] Re: ASP connection string to Access



Hello! nice to get the help from me. Thanks.

You have a wrong thing in your code that is you had placed your .mdb file in

your PWS directory. Trying again by puting your saved database outside of

www rout directory. Thanks.

Jibran Rafique



----- Original Message -----

From: atifds9@h...

Sent: Sunday, October 14, 2001 7:41 PM

To: ASP Database Setup

Subject: [asp_database_setup] ASP connection string to Access



Hi all

I'm developing an ASP application for my final year project and i'm having

trouble getting the ConnectionString to work here is the code and the

error report and help is greatfully recived from a frustrated newbie.



<%@ Language=VBScript %>

<%Option Explicit%>

<!- - #include file="adovbs.inc" - ->



<%

Dim Connect, Constr, Record, FamilyName, FirstName, DOB, AERecNum,

HosRecNum, TraNetNum



Set Connect = Server.CreateObject("ADODB.Connection")



Connect.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data

Source=C:\Inetpub\wwwroot\DCF1.mdb"



Connect.Open



Set Record = Server.CreateObject("ADODB.Recordset")

Record.Open



Record.AddNew

Record("Family Name") = Request("FamilyName")

Record("First Name") = Request("FirstName")

Record("Date Of Birth") = Request("DOB")

Record("A&E Record No") = Request("AERecNum")

Record("Hospital Record No") = Request("HosRecNum")

Record("Trauma Network No") = Request("TraNetNum")

Record.Update

%>



Error Type:

ADODB.Recordset (0x800A0E7D)

The connection cannot be used to perform this operation. It is either

closed or invalid in this context.

/TMP5aip3l75r8.asp, line 15




  Return to Index