Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Can read ODBC database but cannot write to same


Message #1 by "Marlene" <Marlene@a...> on Tue, 24 Apr 2001 14:55:36
I am new to asp programming and am creating a simple application that 

allows folks to create new records in an ODBC database, as well as query 

and display query results.  I can successfully query and read the data, 

but get the following error when I try to create new records:



ADODB.Recordset error '800a0cb3' 



The operation requested by the application is not supported by the 

provider. 



/register2.asp, line 21 





The code in question is as follows:

	<% 

Dim sName, sEmail, rFN, rMN, rLN, rDOB, rDOD, rID, rText, rPhotoID



SET rs = Server.CreateObject("ADODB.Recordset")

rs.Open "tResidents", "DSN=test;"



sName = Request.Form("sName")

sEmail = Request.Form("sEmail")

rFN = Request.Form("rFN")

rMN = Request.Form("rMN")

rLN = Request.Form("rLN")

rDOB = Request.Form("rDOB")

rDOD = Request.Form("rDOD")

rText = Request.Form("rText")



rs.AddNew                          <--------- this is line 21.

rs("sName") = sName

rs("sEmail") = sEmail

rs("rFN") = rFN

rs("rMN") = rMN

rs("rLN") = rLN

rs("rDOB") = rDOB

rs("rDOD") = rDOD

rs("rText") = rText

rs.Update

%>
Message #2 by "Tomm Matthis" <matthis@b...> on Tue, 24 Apr 2001 12:52:51 -0400
It is because you are not specifing the cursor type... so you are 

getting a readonly, foward scrolling recordset.....  check the docs on 

the paramters for opening with a cursor that will allow adding...



Also, a better approach is to not use a recordset at all. Instead use a 

SQL INSERT statement as part of a Connection.Execute.



Tomm



> -----Original Message-----

> From: Marlene [mailto:Marlene@a...]

> Sent: Tuesday, April 24, 2001 2:56 PM

> To: ASP Databases

> Subject: [asp_databases] Can read ODBC database but cannot write to 

same

>

>

> I am new to asp programming and am creating a simple application that

> allows folks to create new records in an ODBC database, as well as 

query

> and display query results.  I can successfully query and read the 

data,

> but get the following error when I try to create new records:

>

> ADODB.Recordset error '800a0cb3'

>

> The operation requested by the application is not supported by the

> provider.

>

> /register2.asp, line 21

>

>

> The code in question is as follows:

> 	<%

> Dim sName, sEmail, rFN, rMN, rLN, rDOB, rDOD, rID, rText, rPhotoID

>

> SET rs =3D Server.CreateObject("ADODB.Recordset")

> rs.Open "tResidents", "DSN=3Dtest;"

>

> sName =3D Request.Form("sName")

> sEmail =3D Request.Form("sEmail")

> rFN =3D Request.Form("rFN")

> rMN =3D Request.Form("rMN")

> rLN =3D Request.Form("rLN")

> rDOB =3D Request.Form("rDOB")

> rDOD =3D Request.Form("rDOD")

> rText =3D Request.Form("rText")

>

> rs.AddNew                          <--------- this is line 21.

> rs("sName") =3D sName

> rs("sEmail") =3D sEmail

> rs("rFN") =3D rFN

> rs("rMN") =3D rMN

> rs("rLN") =3D rLN

> rs("rDOB") =3D rDOB

> rs("rDOD") =3D rDOD

> rs("rText") =3D rText

> rs.Update

> %>

Message #3 by "Charles Feduke" <webmaster@r...> on Tue, 24 Apr 2001 15:56:43 -0400
    Try this instead and see if you get similiar results.  Also make sure that

whatever user is logging in to the test DSN has update rights to the data.



Dim conCon

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

conCon.Open "DSN=test"

conCon.Execute "INSERT INTO tResidents (sName, sEmail) " & _

    " VALUES ('" & Request.Form("sName"), "', '" & Request.Form("sEmail") & "')"



    See if that still returns an error.



- Chuck



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

From: "Marlene" <Marlene@a...>

To: "ASP Databases" <asp_databases@p...>

Sent: Tuesday, April 24, 2001 2:55 PM

Subject: [asp_databases] Can read ODBC database but cannot write to same





> I am new to asp programming and am creating a simple application that

> allows folks to create new records in an ODBC database, as well as query

> and display query results.  I can successfully query and read the data,

> but get the following error when I try to create new records:

>

> ADODB.Recordset error '800a0cb3'

>

> The operation requested by the application is not supported by the

> provider.

>

> /register2.asp, line 21

>

>

> The code in question is as follows:

> <%

> Dim sName, sEmail, rFN, rMN, rLN, rDOB, rDOD, rID, rText, rPhotoID

>

> SET rs = Server.CreateObject("ADODB.Recordset")

> rs.Open "tResidents", "DSN=test;"

>

> sName = Request.Form("sName")

> sEmail = Request.Form("sEmail")

> rFN = Request.Form("rFN")

> rMN = Request.Form("rMN")

> rLN = Request.Form("rLN")

> rDOB = Request.Form("rDOB")

> rDOD = Request.Form("rDOD")

> rText = Request.Form("rText")

>

> rs.AddNew                          <--------- this is line 21.

> rs("sName") = sName

> rs("sEmail") = sEmail

> rs("rFN") = rFN

> rs("rMN") = rMN

> rs("rLN") = rLN

> rs("rDOB") = rDOB

> rs("rDOD") = rDOD

> rs("rText") = rText

> rs.Update

> %>



Message #4 by Marlene Fox-McIntyre <marlene@a...> on Tue, 24 Apr 2001 16:27:51 -0400
OK,  I'm trying and yet somehow failing.  I am totally lost about how to do 

the Connection.Execute.  However, I modified the code as follows to add the 

cursor type:



SET cn = Server.CreateObject("ADODB.Connection")

SET rs = Server.CreateObject("ADODB.Recordset")



cn.Open "HeavenMember"



rs.Open "Select * from tResidents WHERE rID = " & rID, cn, adOpenDynamic



sEmail = Request.Form("sEmail")

rFN = Request.Form("rFN")

rMN = Request.Form("rMN")

rLN = Request.Form("rLN")

rDOB = Request.Form("rDOB")

rDOD = Request.Form("rDOD")



rs("sEmail") = sEmail

rs("rFN") = rFN

rs("rMN") = rMN

rs("rLN") = rLN

rs("rDOB") = rDOB

rs("rDOD") = rDOD

rs.Update



I am still getting the same error on the rs("sEmail").. line.:



ADODB.Field error '800a0cb3'

The operation requested by the application is not supported by the provider.



------------------------------------------------------------------------





At 12:52 PM 4/24/2001 -0400, you wrote:

>It is because you are not specifing the cursor type... so you are getting 

>a readonly, foward scrolling recordset.....  check the docs on the 

>paramters for opening with a cursor that will allow adding...

>

>Also, a better approach is to not use a recordset at all. Instead use a 

>SQL INSERT statement as part of a Connection.Execute.

>

>Tomm

>

> > -----Original Message-----

> > From: Marlene [mailto:Marlene@a...]

> > Sent: Tuesday, April 24, 2001 2:56 PM

> > To: ASP Databases

> > Subject: [asp_databases] Can read ODBC database but cannot write to same

> >

> >

> > I am new to asp programming and am creating a simple application that

> > allows folks to create new records in an ODBC database, as well as query

> > and display query results.  I can successfully query and read the data,

> > but get the following error when I try to create new records:

> >

> > ADODB.Recordset error '800a0cb3'

> >

> > The operation requested by the application is not supported by the

> > provider.

> >

> > /register2.asp, line 21

> >

> >

> > The code in question is as follows:

> >       <%

> > Dim sName, sEmail, rFN, rMN, rLN, rDOB, rDOD, rID, rText, rPhotoID

> >

> > SET rs = Server.CreateObject("ADODB.Recordset")

> > rs.Open "tResidents", "DSN=test;"

> >

> > sName = Request.Form("sName")

> > sEmail = Request.Form("sEmail")

> > rFN = Request.Form("rFN")

> > rMN = Request.Form("rMN")

> > rLN = Request.Form("rLN")

> > rDOB = Request.Form("rDOB")

> > rDOD = Request.Form("rDOD")

> > rText = Request.Form("rText")

> >

> > rs.AddNew                          <--------- this is line 21.

> > rs("sName") = sName

> > rs("sEmail") = sEmail

> > rs("rFN") = rFN

> > rs("rMN") = rMN

> > rs("rLN") = rLN

> > rs("rDOB") = rDOB

> > rs("rDOD") = rDOD

> > rs("rText") = rText

> > rs.Update

> > %>

>

Message #5 by "Tomm Matthis" <matthis@b...> on Tue, 24 Apr 2001 17:07:04 -0400
Try using this syntax:

	rs.Open "Select * from tResidents WHERE rID =3D " & rID, cn, 

adOpenKeyset, adLockOptimistic





Tomm



> -----Original Message-----

> From: Marlene Fox-McIntyre [mailto:marlene@a...]

> Sent: Tuesday, April 24, 2001 4:28 PM

> To: ASP Databases

> Subject: [asp_databases] RE: Can read ODBC database but cannot write 

to

> same

>

>

> OK,  I'm trying and yet somehow failing.  I am totally lost about

> how to do

> the Connection.Execute.  However, I modified the code as follows

> to add the

> cursor type:

>

> SET cn =3D Server.CreateObject("ADODB.Connection")

> SET rs =3D Server.CreateObject("ADODB.Recordset")

>

> cn.Open "HeavenMember"

>

> rs.Open "Select * from tResidents WHERE rID =3D " & rID, cn, 

adOpenDynamic

>

> sEmail =3D Request.Form("sEmail")

> rFN =3D Request.Form("rFN")

> rMN =3D Request.Form("rMN")

> rLN =3D Request.Form("rLN")

> rDOB =3D Request.Form("rDOB")

> rDOD =3D Request.Form("rDOD")

>

> rs("sEmail") =3D sEmail

> rs("rFN") =3D rFN

> rs("rMN") =3D rMN

> rs("rLN") =3D rLN

> rs("rDOB") =3D rDOB

> rs("rDOD") =3D rDOD

> rs.Update

>

> I am still getting the same error on the rs("sEmail").. line.:

>

> ADODB.Field error '800a0cb3'

> The operation requested by the application is not supported by

> the provider.

>

> 

------------------------------------------------------------------------

>

>

> At 12:52 PM 4/24/2001 -0400, you wrote:

> >It is because you are not specifing the cursor type... so you

> are getting

> >a readonly, foward scrolling recordset.....  check the docs on the

> >paramters for opening with a cursor that will allow adding...

> >

> >Also, a better approach is to not use a recordset at all. Instead use 

a

> >SQL INSERT statement as part of a Connection.Execute.

> >

> >Tomm

> >

> > > -----Original Message-----

> > > From: Marlene [mailto:Marlene@a...]

> > > Sent: Tuesday, April 24, 2001 2:56 PM

> > > To: ASP Databases

> > > Subject: [asp_databases] Can read ODBC database but cannot

> write to same

> > >

> > >

> > > I am new to asp programming and am creating a simple application 

that

> > > allows folks to create new records in an ODBC database, as

> well as query

> > > and display query results.  I can successfully query and read

> the data,

> > > but get the following error when I try to create new records:

> > >

> > > ADODB.Recordset error '800a0cb3'

> > >

> > > The operation requested by the application is not supported by the

> > > provider.

> > >

> > > /register2.asp, line 21

> > >

> > >

> > > The code in question is as follows:

> > >       <%

> > > Dim sName, sEmail, rFN, rMN, rLN, rDOB, rDOD, rID, rText, rPhotoID

> > >

> > > SET rs =3D Server.CreateObject("ADODB.Recordset")

> > > rs.Open "tResidents", "DSN=3Dtest;"

> > >

> > > sName =3D Request.Form("sName")

> > > sEmail =3D Request.Form("sEmail")

> > > rFN =3D Request.Form("rFN")

> > > rMN =3D Request.Form("rMN")

> > > rLN =3D Request.Form("rLN")

> > > rDOB =3D Request.Form("rDOB")

> > > rDOD =3D Request.Form("rDOD")

> > > rText =3D Request.Form("rText")

> > >

> > > rs.AddNew                          <--------- this is line 21.

> > > rs("sName") =3D sName

> > > rs("sEmail") =3D sEmail

> > > rs("rFN") =3D rFN

> > > rs("rMN") =3D rMN

> > > rs("rLN") =3D rLN

> > > rs("rDOB") =3D rDOB

> > > rs("rDOD") =3D rDOD

> > > rs("rText") =3D rText

> > > rs.Update

> > > %>

> >

>

Message #6 by Marlene Fox-McIntyre <marlene@a...> on Tue, 24 Apr 2001 17:26:22 -0400
Chuck,



Bless you! You are my hero of the day!!!!  It all works, and I even added 

almost all of the other fields I need to add.



Marlene



At 03:56 PM 4/24/2001 -0400, you wrote:

>     Try this instead and see if you get similiar results.  Also make sure 

> that

>whatever user is logging in to the test DSN has update rights to the data.

>

>Dim conCon

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

>conCon.Open "DSN=test"

>conCon.Execute "INSERT INTO tResidents (sName, sEmail) " & _

>     " VALUES ('" & Request.Form("sName"), "', '" & Request.Form("sEmail") 

> & "')"

>

>     See if that still returns an error.

>

>- Chuck

>

>----- Original Message -----

>From: "Marlene" <Marlene@a...>

>To: "ASP Databases" <asp_databases@p...>

>Sent: Tuesday, April 24, 2001 2:55 PM

>Subject: [asp_databases] Can read ODBC database but cannot write to same

>

>

> > I am new to asp programming and am creating a simple application that

> > allows folks to create new records in an ODBC database, as well as query

> > and display query results.  I can successfully query and read the data,

> > but get the following error when I try to create new records:

> >

> > ADODB.Recordset error '800a0cb3'

> >

> > The operation requested by the application is not supported by the

> > provider.

> >

> > /register2.asp, line 21

> >

> >

> > The code in question is as follows:

> > <%

> > Dim sName, sEmail, rFN, rMN, rLN, rDOB, rDOD, rID, rText, rPhotoID

> >

> > SET rs = Server.CreateObject("ADODB.Recordset")

> > rs.Open "tResidents", "DSN=test;"

> >

> > sName = Request.Form("sName")

> > sEmail = Request.Form("sEmail")

> > rFN = Request.Form("rFN")

> > rMN = Request.Form("rMN")

> > rLN = Request.Form("rLN")

> > rDOB = Request.Form("rDOB")

> > rDOD = Request.Form("rDOD")

> > rText = Request.Form("rText")

> >

> > rs.AddNew                          <--------- this is line 21.

> > rs("sName") = sName

> > rs("sEmail") = sEmail

> > rs("rFN") = rFN

> > rs("rMN") = rMN

> > rs("rLN") = rLN

> > rs("rDOB") = rDOB

> > rs("rDOD") = rDOD

> > rs("rText") = rText

> > rs.Update

> > %>

>

Message #7 by "Charles Feduke" <webmaster@r...> on Tue, 24 Apr 2001 19:01:42 -0400
    On a final note, please be sure to escape all 's with 's:



sGood = Replace(Request.Form("field"), "'", "''")



    Its best if you write yourself a function to do this, to limit typing:



Public Function sNormal(sField)

    sNormal = Replace(Request.Form(sField), "'", "''")

End Function



    This way you can properly enter names like "O'brien" (without it, you would

be entering data like 'O'brien', stopping the ' short of the brien part!).



- Chuck



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

From: "Marlene Fox-McIntyre" <marlene@a...>

To: "ASP Databases" <asp_databases@p...>

Sent: Tuesday, April 24, 2001 5:26 PM

Subject: [asp_databases] Re: Can read ODBC database but cannot write to same





> Chuck,

>

> Bless you! You are my hero of the day!!!!  It all works, and I even added

> almost all of the other fields I need to add.

>

> Marlene

>

> At 03:56 PM 4/24/2001 -0400, you wrote:

> >     Try this instead and see if you get similiar results.  Also make sure

> > that

> >whatever user is logging in to the test DSN has update rights to the data.

> >

> >Dim conCon

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

> >conCon.Open "DSN=test"

> >conCon.Execute "INSERT INTO tResidents (sName, sEmail) " & _

> >     " VALUES ('" & Request.Form("sName"), "', '" & Request.Form("sEmail")

> > & "')"

> >

> >     See if that still returns an error.

> >

> >- Chuck


  Return to Index