Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: AddNew method error


Message #1 by "vijay das" <anchovies76@h...> on Tue, 16 Jan 2001 08:42:24
Hi people,





I am trying to add a new record to a database. So, naturally, I am using the 

AddNew method for my recordset. However, I keep getting this error: 

"ADODB.Recordset error ''800a0cb3'' The operation requested by the 

application is not supported by the provider(REferring to the line with the 

AddNew method in the code below)

. " Yes, I am including the adovbs.inc file. Why is this error occurring?  

Your prompt reply is greatly appreciated.,Please feel free to edit my code.



Thank you







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

	objConn.Open strConnect





rsCR.Open "select * from CustomerReview where PdtID=" & PdtID & " and 

PdtDescription='" & PdtDescription & "' and Email='" & Email & "'",objConn

if rsCR.EOF then



	rsCR.AddNew



	rsCR("PdtID")=PdtID

	rsCR("PdtDescription")=PdtDescription

	rsCR("Rating")= Rating

	rsCR("Review")= Review

	rsCR("Name")= NameReview

	rsCR("Email")= Email

	rsCR("Allow")= 0

	rsCR("Headline")= Headline



	rsCR.Update



end if



Message #2 by PERRETTA Franco <Franco.PERRETTA@c...> on Tue, 16 Jan 2001 11:11:11 +0100
Dear,

Unfortunately to add record in ASP you should use the SQL language INSERT TO

and UPDATE. Does not work as in MS ACCESS or in Visual Basic.

Here you are an example:



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

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

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

MyConn.Open "Provider=SQLOLEDB;DRIVER=SQL

Server;SERVER=acdc;DATABASE=dct_manage;UID=dct_manage;PWD=0b7k23"

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



	TempMatricule =Request("MatInput")

      TempMornArrHo=Request("MornHourArr" & i &"")

      TempMornDepHo=Request("MornHourDep" & i &"")

    TempMornTotHo=TempMornDepHo - TempMornArrHo

   

      TempAftNoArrHo=Request("AfteHourArr" & i &"")

      TempAftNoDepHo=Request("AfteHourDep" & i &"")

    TempAftNoTotHo=TempAftNoDepHo - TempAftNoArrHo

    

    TempTotDayHo=TempMornTotHo + TempAftNoTotHo



    TempDoctorAppont=Request("DoctAppoint" & i &"")

     '=Request("" & i &"")

     '=Request("" & i &"")

     '=Request("" & i &"")

	TempDateSheetFor = Request("DateInput" & i &"")



	TempDateSheetFor = Right(TempDateSheetFor,10)

	If IsDate(TempDateSheetFor)=True Then 

		TempDateSheetFor = FormatDateTime(TempDateSheetFor,

vbShortDate)



		'TempDateSheet=Left(TempDateSheetFor,3)

		'TempDateSheet=TempDateSheet + Mid(TempDateSheetFor,4,3) 

		'TempDateSheet=TempDateSheet + Right(TempDateSheetFor,2)



		TempDateSheet=Mid(TempDateSheetFor,4,3) 'Month

		TempDateSheet=TempDateSheet + Left(TempDateSheetFor,2) 'Day 

		TempDateSheet=TempDateSheet + Right(TempDateSheetFor,3)'Year



		qd = "SELECT MATRICULE, IDDateSheet FROM IndivTimeRec WHERE

MATRICULE =" & TempMatricule &" AND IDDateSheet='" & TempDateSheet & "'"

		Set Rs=MyConn.Execute(qd)



		If Rs.EOF=False Then

 

		  qd = "UPDATE IndivTimeRec SET IDDateSheet = '" &

TempDateSheet & "',"



		   qd = qd + "MornArrHo = " & TempMornArrHo & ","

		   qd = qd + "MornDepHo = " & TempMornDepHo & ","

'TempMornTotHo

		  qd = qd + "MornTotHo = " & TempMornTotHo & ","



		   qd = qd + "AftNoArrHo = " & TempAftNoArrHo & ","

		   qd = qd + "AftNoDepHo = " & TempAftNoDepHo & ","

		  qd = qd + "AftNoTotHo = " & TempAftNoTotHo & ","

		  

		  qd = qd + "TotDayHo = " & TempTotDayHo & ","

		  

		  qd = qd + "DoctorAppont = " & TempDoctorAppont & ""



		  qd = qd + "WHERE MATRICULE = "& TempMatricule & " AND

IDDateSheet='" & TempDateSheet & "'"

		  

		  Set Rs=MyConn.Execute(qd)



		Else

		 qd = "INSERT INTO IndivTimeRec

(MATRICULE,IDDateSheet,MornArrHo,MornDepHo,MornTotHo,AftNoArrHo,AftNoDepHo,A

ftNoTotHo,"

		 qd = qd + "TotDayHo,DoctorAppont)"

		 

		 qd = qd + "VALUES ("& TempMatricule & ",'" & TempDateSheet

& "',"& TempMornArrHo & ","& TempMornDepHo & ","& TempMornTotHo & ","

		 qd = qd + ""& TempAftNoArrHo & ","& TempAftNoDepHo & ","&

TempAftNoTotHo & ","& TempTotDayHo & ","& TempDoctorAppont & ")"

          

		  Set Rs=MyConn.Execute(qd)

		End If

	End If



MyConn.Close

set MyConn = nothing

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

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





             Franco

___________________________________

                     Perretta Franco

                            software developer

                           Council of Europe

           Department of Information Technology

                      Information Access Unit

                     67075 Strasbourg Cedex

tel: +33 (0)3 88 41 22 18  fax: +33 (0)3 88 41 27 39

          mailto:franco.perretta@c...

                    http://www.coe.int



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

From: 	vijay das [mailto:anchovies76@h...] 

Sent:	Tuesday 16 January 2001 19:11

To:	ASP Databases

Subject:	[asp_databases] AddNew method error



Hi people,





I am trying to add a new record to a database. So, naturally, I am using the



AddNew method for my recordset. However, I keep getting this error: 

"ADODB.Recordset error ''800a0cb3'' The operation requested by the 

application is not supported by the provider(REferring to the line with the 

AddNew method in the code below)

. " Yes, I am including the adovbs.inc file. Why is this error occurring?  

Your prompt reply is greatly appreciated.,Please feel free to edit my code.



Thank you







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

	objConn.Open strConnect





rsCR.Open "select * from CustomerReview where PdtID=" & PdtID & " and 

PdtDescription='" & PdtDescription & "' and Email='" & Email & "'",objConn

if rsCR.EOF then



	rsCR.AddNew



	rsCR("PdtID")=PdtID

	rsCR("PdtDescription")=PdtDescription

	rsCR("Rating")= Rating

	rsCR("Review")= Review

	rsCR("Name")= NameReview

	rsCR("Email")= Email

	rsCR("Allow")= 0

	rsCR("Headline")= Headline



	rsCR.Update



end if





-
Message #3 by Imar Spaanjaars <Imar@S...> on Tue, 16 Jan 2001 11:38:50 +0100
You are opening the recordset with no cursor- and locktype specified. This 

will have the recordset fall back to its defaults which are 

adOpenForwardOnly and adLockReadOnly respectively. This makes it impossible 

to update the recordset.



So state your cursor- and locktypes explicitly, after the connection:



<CODE>

         Dim sSQL

         sSQL = "select * from CustomerReview where PdtID=" & PdtID & " and 

PdtDescription='" & PdtDescription & "' and Email='" & Email & "'"

         rsCR.Open sSQL, objConn, adOpenStatic, adLockBatchOptimistic, 

adCmdText

</code>



In this example both the cursor- and the lock type are set to the most 

efficient when it comes to performance. For your needs you may have to 

change them to other types.



See http://www.asptoday.com/articles/20000426.htm (section What are the 

Most Efficient Cursor and Lock Types?) for more info on this.





An even better and faster solution is to skip the addNew method, and use 

native SQL INSERT commands. Then execute the SQL statement with the 

.Execute() method of the connection object.



HtH



Imar









At 10:10 AM 1/16/2001 -0800, you wrote:

>Hi people,

>

>

>I am trying to add a new record to a database. So, naturally, I am using the

>AddNew method for my recordset. However, I keep getting this error:

>"ADODB.Recordset error ''800a0cb3'' The operation requested by the

>application is not supported by the provider(REferring to the line with the

>AddNew method in the code below)

>. " Yes, I am including the adovbs.inc file. Why is this error occurring?

>Your prompt reply is greatly appreciated.,Please feel free to edit my code.

>

>Thank you

>

>

>

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

>         objConn.Open strConnect

>

>

>rsCR.Open "select * from CustomerReview where PdtID=" & PdtID & " and

>PdtDescription='" & PdtDescription & "' and Email='" & Email & "'",objConn

>if rsCR.EOF then

>

>         rsCR.AddNew

>

>         rsCR("PdtID")=PdtID

>         rsCR("PdtDescription")=PdtDescription

>         rsCR("Rating")= Rating

>         rsCR("Review")= Review

>         rsCR("Name")= NameReview

>         rsCR("Email")= Email

>         rsCR("Allow")= 0

>         rsCR("Headline")= Headline

>

>         rsCR.Update

>

>end if



Message #4 by "John K" <kamau@s...> on Tue, 16 Jan 2001 18:29:38 +0300
i had the same error for about a week a few days ago and I realised the

problem.

First I'd recommend you include msado15.dll instead of adovbs.inc

Make sure you're recordset is not readonly by specifying the cursortype and

locktype

like so



	sqlstring = "select * from CustomerReview where PdtID=" & PdtID & " and

PdtDescription='" & PdtDescription & "' and Email='" & Email  & "'"

	rsCr.open sqlstring, objconn, adOpenDynamic, adLockOptimistic



then if you have 'option explicit' at the top don't re declare the 'ad'

constants. I had made that mistake also. that will reset them again thus

defeating the purpose of including adovbs.inc.

Other that that it should work fine.



john



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

> From: bounce-asp_databases-299218@p...

> [mailto:bounce-asp_databases-299218@p...]On Behalf Of

> vijay das

> Sent: Tuesday, January 16, 2001 9:11 PM

> To: ASP Databases

> Subject: [asp_databases] AddNew method error

>

>

> Hi people,

>

>

> I am trying to add a new record to a database. So, naturally,

> I am using the

> AddNew method for my recordset. However, I keep getting this error:

> "ADODB.Recordset error ''800a0cb3'' The operation requested by the

> application is not supported by the provider(REferring to the

> line with the

> AddNew method in the code below)

> . " Yes, I am including the adovbs.inc file. Why is this

> error occurring?

> Your prompt reply is greatly appreciated.,Please feel free to

> edit my code.

>

> Thank you

>

>

>

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

> 	objConn.Open strConnect

>

>

> rsCR.Open "select * from CustomerReview where PdtID=" & PdtID & " and

> PdtDescription='" & PdtDescription & "' and Email='" & Email

> & "'",objConn

> if rsCR.EOF then

>

> 	rsCR.AddNew

>

> 	rsCR("PdtID")=PdtID

> 	rsCR("PdtDescription")=PdtDescription

> 	rsCR("Rating")= Rating

> 	rsCR("Review")= Review

> 	rsCR("Name")= NameReview

> 	rsCR("Email")= Email

> 	rsCR("Allow")= 0

> 	rsCR("Headline")= Headline

>

> 	rsCR.Update

>

> end if

>

>

Message #5 by "John K" <kamau@s...> on Tue, 16 Jan 2001 18:34:00 +0300
Perretta I"m using access 2000 and all is well using ado.

All my pages use AddNew to add records and believe me I've had no errors

whatosever.

But to be fair I do recommend using SQL INSERT to add records.

john



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

>

> Dear,

> Unfortunately to add record in ASP you should use the SQL

> language INSERT TO

> and UPDATE. Does not work as in MS ACCESS or in Visual Basic.

> Here you are an example:

>

> --------------------------------------------------------------

> --------------

> --------------------------

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

> MyConn.Open "Provider=SQLOLEDB;DRIVER=SQL

> Server;SERVER=acdc;DATABASE=dct_manage;UID=dct_manage;PWD=0b7k23"

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

>

> 	TempMatricule =Request("MatInput")

>       TempMornArrHo=Request("MornHourArr" & i &"")

>       TempMornDepHo=Request("MornHourDep" & i &"")

>     TempMornTotHo=TempMornDepHo - TempMornArrHo

>

>       TempAftNoArrHo=Request("AfteHourArr" & i &"")

>       TempAftNoDepHo=Request("AfteHourDep" & i &"")

>     TempAftNoTotHo=TempAftNoDepHo - TempAftNoArrHo

>

>     TempTotDayHo=TempMornTotHo + TempAftNoTotHo

>

>     TempDoctorAppont=Request("DoctAppoint" & i &"")

>      '=Request("" & i &"")

>      '=Request("" & i &"")

>      '=Request("" & i &"")

> 	TempDateSheetFor = Request("DateInput" & i &"")

>

> 	TempDateSheetFor = Right(TempDateSheetFor,10)

> 	If IsDate(TempDateSheetFor)=True Then

> 		TempDateSheetFor = FormatDateTime(TempDateSheetFor,

> vbShortDate)

>

> 		'TempDateSheet=Left(TempDateSheetFor,3)

> 		'TempDateSheet=TempDateSheet +

> Mid(TempDateSheetFor,4,3)

> 		'TempDateSheet=TempDateSheet + Right(TempDateSheetFor,2)

>

> 		TempDateSheet=Mid(TempDateSheetFor,4,3) 'Month

> 		TempDateSheet=TempDateSheet +

> Left(TempDateSheetFor,2) 'Day

> 		TempDateSheet=TempDateSheet +

> Right(TempDateSheetFor,3)'Year

>

> 		qd = "SELECT MATRICULE, IDDateSheet FROM

> IndivTimeRec WHERE

> MATRICULE =" & TempMatricule &" AND IDDateSheet='" &

> TempDateSheet & "'"

> 		Set Rs=MyConn.Execute(qd)

>

> 		If Rs.EOF=False Then

>

> 		  qd = "UPDATE IndivTimeRec SET IDDateSheet = '" &

> TempDateSheet & "',"

>

> 		   qd = qd + "MornArrHo = " & TempMornArrHo & ","

> 		   qd = qd + "MornDepHo = " & TempMornDepHo & ","

> 'TempMornTotHo

> 		  qd = qd + "MornTotHo = " & TempMornTotHo & ","

>

> 		   qd = qd + "AftNoArrHo = " & TempAftNoArrHo & ","

> 		   qd = qd + "AftNoDepHo = " & TempAftNoDepHo & ","

> 		  qd = qd + "AftNoTotHo = " & TempAftNoTotHo & ","

>

> 		  qd = qd + "TotDayHo = " & TempTotDayHo & ","

>

> 		  qd = qd + "DoctorAppont = " & TempDoctorAppont & ""

>

> 		  qd = qd + "WHERE MATRICULE = "& TempMatricule & " AND

> IDDateSheet='" & TempDateSheet & "'"

>

> 		  Set Rs=MyConn.Execute(qd)

>

> 		Else

> 		 qd = "INSERT INTO IndivTimeRec

> (MATRICULE,IDDateSheet,MornArrHo,MornDepHo,MornTotHo,AftNoArrH

> o,AftNoDepHo,A

> ftNoTotHo,"

> 		 qd = qd + "TotDayHo,DoctorAppont)"

>

> 		 qd = qd + "VALUES ("& TempMatricule & ",'" &

> TempDateSheet

> & "',"& TempMornArrHo & ","& TempMornDepHo & ","& TempMornTotHo & ","

> 		 qd = qd + ""& TempAftNoArrHo & ","&

> TempAftNoDepHo & ","&

> TempAftNoTotHo & ","& TempTotDayHo & ","& TempDoctorAppont & ")"

>

> 		  Set Rs=MyConn.Execute(qd)

> 		End If

> 	End If

>

> MyConn.Close

> set MyConn = nothing

> --------------------------------------------------------------

> --------------

> -------------------------

>

>

>              Franco

> ___________________________________

>                      Perretta Franco

>                             software developer

>                            Council of Europe

>            Department of Information Technology

>                       Information Access Unit

>                      67075 Strasbourg Cedex

> tel: +33 (0)3 88 41 22 18  fax: +33 (0)3 88 41 27 39

>           mailto:franco.perretta@c...

>                     http://www.coe.int

>

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

> From: 	vijay das [mailto:anchovies76@h...]

> Sent:	Tuesday 16 January 2001 19:11

> To:	ASP Databases

> Subject:	[asp_databases] AddNew method error

>

> Hi people,

>

>

> I am trying to add a new record to a database. So, naturally,

> I am using the

>

> AddNew method for my recordset. However, I keep getting this error:

> "ADODB.Recordset error ''800a0cb3'' The operation requested by the

> application is not supported by the provider(REferring to the

> line with the

> AddNew method in the code below)

> . " Yes, I am including the adovbs.inc file. Why is this

> error occurring?

> Your prompt reply is greatly appreciated.,Please feel free to

> edit my code.

>

> Thank you

>

>

>

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

> 	objConn.Open strConnect

>

>

> rsCR.Open "select * from CustomerReview where PdtID=" & PdtID & " and

> PdtDescription='" & PdtDescription & "' and Email='" & Email

> & "'",objConn

> if rsCR.EOF then

>

> 	rsCR.AddNew

>

> 	rsCR("PdtID")=PdtID

> 	rsCR("PdtDescription")=PdtDescription

> 	rsCR("Rating")= Rating

> 	rsCR("Review")= Review

> 	rsCR("Name")= NameReview

> 	rsCR("Email")= Email

> 	rsCR("Allow")= 0

> 	rsCR("Headline")= Headline

>

> 	rsCR.Update

>

> end if

>

>

Message #6 by Gregory_Griffiths@c... on Tue, 16 Jan 2001 16:18:19 +0000
I believe that you just need to parse the text and replace them all. 

Can't recall how to do it, but I think it'll be int eh archives of this 

- or one of the other ASP P2P lists.



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

> From: kamau@s... [mailto:kamau@s...]

> Sent: 16 January 2001 15:30

> To: kamau@s...; asp_databases@p...

> Subject: [asp_databases] RE: AddNew method error

> 

> 

> i had the same error for about a week a few days ago and I 

> realised the

> problem.

> First I'd recommend you include msado15.dll instead of adovbs.inc

> Make sure you're recordset is not readonly by specifying the 

> cursortype and

> locktype

> like so

> 

> 	sqlstring = "select * from CustomerReview where PdtID=" 

> & PdtID & " and

> PdtDescription='" & PdtDescription & "' and Email='" & Email  & "'"

> 	rsCr.open sqlstring, objconn, adOpenDynamic, adLockOptimistic

> 

> then if you have 'option explicit' at the top don't re 

> declare the 'ad'

> constants. I had made that mistake also. that will reset them 

> again thus

> defeating the purpose of including adovbs.inc.

> Other that that it should work fine.

> 

> john

> 

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

> > From: bounce-asp_databases-299218@p...

> > [mailto:bounce-asp_databases-299218@p...]On Behalf Of

> > vijay das

> > Sent: Tuesday, January 16, 2001 9:11 PM

> > To: ASP Databases

> > Subject: [asp_databases] AddNew method error

> >

> >

> > Hi people,

> >

> >

> > I am trying to add a new record to a database. So, naturally,

> > I am using the

> > AddNew method for my recordset. However, I keep getting this error:

> > "ADODB.Recordset error ''800a0cb3'' The operation requested by the

> > application is not supported by the provider(REferring to the

> > line with the

> > AddNew method in the code below)

> > . " Yes, I am including the adovbs.inc file. Why is this

> > error occurring?

> > Your prompt reply is greatly appreciated.,Please feel free to

> > edit my code.

> >

> > Thank you

> >

> >

> >

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

> > 	objConn.Open strConnect

> >

> >

> > rsCR.Open "select * from CustomerReview where PdtID=" & 

> PdtID & " and

> > PdtDescription='" & PdtDescription & "' and Email='" & Email

> > & "'",objConn

> > if rsCR.EOF then

> >

> > 	rsCR.AddNew

> >

> > 	rsCR("PdtID")=PdtID

> > 	rsCR("PdtDescription")=PdtDescription

> > 	rsCR("Rating")= Rating

> > 	rsCR("Review")= Review

> > 	rsCR("Name")= NameReview

> > 	rsCR("Email")= Email

> > 	rsCR("Allow")= 0

> > 	rsCR("Headline")= Headline

> >

> > 	rsCR.Update

> >

> > end if

> >

> >
Message #7 by "vijay das" <anchovies76@h...> on Thu, 18 Jan 2001 04:36:01
I did what you said Imar but still the error is there.>>"ADODB.Recordset 

error ''800a0cb3'' The operation requested by the application is not 

supported by the provider(REferring to the line

with the AddNew method)



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

  objConn.Open strConnect



Dim sSQL

sSQL = "select * from CustomerReview where PdtID=" & PdtID & " and

PdtDescription='" & PdtDescription & "' and Email='" & Email & "'"

rsCR.Open sSQL, objConn,  adOpenStatic,adLockBatchOptimistic,adCmdText





if rsCR.EOF then

>>

>>         rsCR.AddNew

>>

>>         rsCR("PdtID")=PdtID

>>         rsCR("PdtDescription")=PdtDescription

>>         rsCR("Rating")= Rating

>>         rsCR("Review")= Review

>>         rsCR("Name")= NameReview

>>         rsCR("Email")= Email

>>         rsCR("Allow")= 0

>>         rsCR("Headline")= Headline

>>

>>         rsCR.Update

>>

>>end if













>From: Imar Spaanjaars <Imar@S...>

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

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

>Subject: [asp_databases] Re: AddNew method error

>Date: Tue, 16 Jan 2001 11:38:50 +0100

>

>You are opening the recordset with no cursor- and locktype specified. This

>will have the recordset fall back to its defaults which are

>adOpenForwardOnly and adLockReadOnly respectively. This makes it impossible

>to update the recordset.

>

>So state your cursor- and locktypes explicitly, after the connection:

>

><CODE>

>         Dim sSQL

>         sSQL = "select * from CustomerReview where PdtID=" & PdtID & " and

>PdtDescription='" & PdtDescription & "' and Email='" & Email & "'"

>         rsCR.Open sSQL, objConn, adOpenStatic, adLockBatchOptimistic,

>adCmdText

></code>

>

>In this example both the cursor- and the lock type are set to the most

>efficient when it comes to performance. For your needs you may have to

>change them to other types.

>

>See http://www.asptoday.com/articles/20000426.htm (section What are the

>Most Efficient Cursor and Lock Types?) for more info on this.

>

>

>An even better and faster solution is to skip the addNew method, and use

>native SQL INSERT commands. Then execute the SQL statement with the

>.Execute() method of the connection object.

>

>HtH

>

>Imar

>

>

>

>

>At 10:10 AM 1/16/2001 -0800, you wrote:

>>Hi people,

>>

>>

>>I am trying to add a new record to a database. So, naturally, I am using 

>>the

>>AddNew method for my recordset. However, I keep getting this error:

>>"ADODB.Recordset error ''800a0cb3'' The operation requested by the

>>application is not supported by the provider(REferring to the line with 

>>the

>>AddNew method in the code below)

>>. " Yes, I am including the adovbs.inc file. Why is this error occurring?

>>Your prompt reply is greatly appreciated.,Please feel free to edit my 

>>code.

>>

>>Thank you

>>

>>

>>

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

>>         objConn.Open strConnect

>>

>>

>>rsCR.Open "select * from CustomerReview where PdtID=" & PdtID & " and

>>PdtDescription='" & PdtDescription & "' and Email='" & Email & "'",objConn

>>if rsCR.EOF then

>>

>>         rsCR.AddNew

>>

>>         rsCR("PdtID")=PdtID

>>         rsCR("PdtDescription")=PdtDescription

>>         rsCR("Rating")= Rating

>>         rsCR("Review")= Review

>>         rsCR("Name")= NameReview

>>         rsCR("Email")= Email

>>         rsCR("Allow")= 0

>>         rsCR("Headline")= Headline

>>

>>         rsCR.Update

>>

>>end if

>

>

Message #8 by "Ken Schaefer" <ken@a...> on Thu, 18 Jan 2001 18:32:08 +1100
You need:



<%

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

rsCr.Open sSQL, objConn, adOpenStatic, adLockOptimistic, adCmdText

%>



Cheers

Ken



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

From: "vijay das" <anchovies76@h...>

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

Sent: Thursday, January 18, 2001 4:36 AM

Subject: [asp_databases] Re: AddNew method error





> I did what you said Imar but still the error is there.>>"ADODB.Recordset 

> error ''800a0cb3'' The operation requested by the application is not 

> supported by the provider(REferring to the line

> with the AddNew method)

> 

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

>   objConn.Open strConnect

> 

> Dim sSQL

> sSQL = "select * from CustomerReview where PdtID=" & PdtID & " and

> PdtDescription='" & PdtDescription & "' and Email='" & Email & "'"

> rsCR.Open sSQL, objConn,  adOpenStatic,adLockBatchOptimistic,adCmdText

> 

> 

> if rsCR.EOF then

> >>

> >>         rsCR.AddNew

> >>

> >>         rsCR("PdtID")=PdtID

> >>         rsCR("PdtDescription")=PdtDescription

> >>         rsCR("Rating")= Rating

> >>         rsCR("Review")= Review

> >>         rsCR("Name")= NameReview

> >>         rsCR("Email")= Email

> >>         rsCR("Allow")= 0

> >>         rsCR("Headline")= Headline

> >>

> >>         rsCR.Update

> >>

> >>end if





Message #9 by Imar Spaanjaars <Imar@S...> on Thu, 18 Jan 2001 08:37:52 +0100
I think, but I am not completely sure, that you need to do two things:



1. Add <%Option Explicit %> to the top of your page. (To catch errors like 

undefined constants)

2. Define the constants you are using. (adOpenStatic etc).



Basically, there are three ways to do that:



1. Declare them yourself: Const adOpenForwardOnly = 0 etc

Not recommended, 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



If it still doesn't work, I suggest you post the complete ASP source so we 

can take another look.





HtH



Imar









At 04:36 AM 1/18/2001 +0000, you wrote:

>I did what you said Imar but still the error is there.>>"ADODB.Recordset 

>error ''800a0cb3'' The operation requested by the application is not 

>supported by the provider(REferring to the line

>with the AddNew method)

>

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

>  objConn.Open strConnect

>

>Dim sSQL

>sSQL = "select * from CustomerReview where PdtID=" & PdtID & " and

>PdtDescription='" & PdtDescription & "' and Email='" & Email & "'"

>rsCR.Open sSQL, objConn,  adOpenStatic, adLockBatchOptimistic, adCmdText



Message #10 by "Pappas Nikos" <pappas@c...> on Thu, 18 Jan 2001 10:25:53 -0800
try this



rsCR.Open sSQL, objConn, 2,3





>>

>>         rsCR.AddNew

>>

>>         rsCR.fields("PdtID")=PdtID

>>         rsCR.fields("PdtDescription")=PdtDescription

>>         rsCR.fields("Rating")= Rating

>>         rsCR.fields("Review")= Review

>>         rsCR.fields("Name")= NameReview

>>         rsCR.fields("Email")= Email

>>         rsCR.fields("Allow")= 0

>>         rsCR.fields("Headline")= Headline

>>

>>         rsCR.Update

>>





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

From: vijay das [mailto:anchovies76@h...]

Sent: Thursday, January 18, 2001 4:36 AM

To: ASP Databases

Subject: [asp_databases] Re: AddNew method error





I did what you said Imar but still the error is there.>>"ADODB.Recordset

error ''800a0cb3'' The operation requested by the application is not

supported by the provider(REferring to the line

with the AddNew method)



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

  objConn.Open strConnect



Dim sSQL

sSQL = "select * from CustomerReview where PdtID=" & PdtID & " and

PdtDescription='" & PdtDescription & "' and Email='" & Email & "'"

rsCR.Open sSQL, objConn,  adOpenStatic,adLockBatchOptimistic,adCmdText





if rsCR.EOF then

>>

>>         rsCR.AddNew

>>

>>         rsCR("PdtID")=PdtID

>>         rsCR("PdtDescription")=PdtDescription

>>         rsCR("Rating")= Rating

>>         rsCR("Review")= Review

>>         rsCR("Name")= NameReview

>>         rsCR("Email")= Email

>>         rsCR("Allow")= 0

>>         rsCR("Headline")= Headline

>>

>>         rsCR.Update

>>

>>end if













>From: Imar Spaanjaars <Imar@S...>

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

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

>Subject: [asp_databases] Re: AddNew method error

>Date: Tue, 16 Jan 2001 11:38:50 +0100

>

>You are opening the recordset with no cursor- and locktype specified. This

>will have the recordset fall back to its defaults which are

>adOpenForwardOnly and adLockReadOnly respectively. This makes it impossible

>to update the recordset.

>

>So state your cursor- and locktypes explicitly, after the connection:

>

><CODE>

>         Dim sSQL

>         sSQL = "select * from CustomerReview where PdtID=" & PdtID & " and

>PdtDescription='" & PdtDescription & "' and Email='" & Email & "'"

>         rsCR.Open sSQL, objConn, adOpenStatic, adLockBatchOptimistic,

>adCmdText

></code>

>

>In this example both the cursor- and the lock type are set to the most

>efficient when it comes to performance. For your needs you may have to

>change them to other types.

>

>See http://www.asptoday.com/articles/20000426.htm (section What are the

>Most Efficient Cursor and Lock Types?) for more info on this.

>

>

>An even better and faster solution is to skip the addNew method, and use

>native SQL INSERT commands. Then execute the SQL statement with the

>.Execute() method of the connection object.

>

>HtH

>

>Imar

>

>

>

>

>At 10:10 AM 1/16/2001 -0800, you wrote:

>>Hi people,

>>

>>

>>I am trying to add a new record to a database. So, naturally, I am using

>>the

>>AddNew method for my recordset. However, I keep getting this error:

>>"ADODB.Recordset error ''800a0cb3'' The operation requested by the

>>application is not supported by the provider(REferring to the line with

>>the

>>AddNew method in the code below)

>>. " Yes, I am including the adovbs.inc file. Why is this error occurring?

>>Your prompt reply is greatly appreciated.,Please feel free to edit my

>>code.

>>

>>Thank you

>>

>>

>>

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

>>         objConn.Open strConnect

>>

>>

>>rsCR.Open "select * from CustomerReview where PdtID=" & PdtID & " and

>>PdtDescription='" & PdtDescription & "' and Email='" & Email & "'",objConn

>>if rsCR.EOF then

>>

>>         rsCR.AddNew

>>

>>         rsCR("PdtID")=PdtID

>>         rsCR("PdtDescription")=PdtDescription

>>         rsCR("Rating")= Rating

>>         rsCR("Review")= Review

>>         rsCR("Name")= NameReview

>>         rsCR("Email")= Email

>>         rsCR("Allow")= 0

>>         rsCR("Headline")= Headline

>>

>>         rsCR.Update

>>

>>end if

>

>


  Return to Index