Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Addnew method Error


Message #1 by "Nisha Nambiar" <nishanam@y...> on Wed, 18 Oct 2000 16:32:08 +0100
Hi

 I am trying to add the data to a table in SQL SERVER and i get this

error.



ADODB.Recordset error '800a0cb3' 

The operation requested by the application is not supported by the

provider.

/begasp/PrintOrder.asp, line 37 



Here's my code

<%

Dim Conn

Dim rsNextOrder

Dim rsOrder



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

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

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



Conn.Open "DSN=Reliacom;UID=sa;Pwd="

rsNextOrder.Open "tblNextOrder", Conn

rsOrder.Open "tblOrder", Conn  'This the table I want to save records



rsOrder.AddNew   'This is were the error occurs

rsOrder.Fields("OrderNumber") = rsNextOrder("NextOrder")

rsOrder.Fields("RequestedBy") = Request.Form("RequestBy")

rsOrder.Fields("Store") = Request.Form("cboStore")

rsOrder.Fields("Department") = Request.Form("cboDept")

rsOrder.Fields("Reason") = Request.Form("Reason")

rsOrder.Update

%>



I would appreciate the help.

Nisha

Message #2 by Charles.Whinney@i... on Wed, 18 Oct 2000 17:02:35 +0100
Try explicitly opening the record set as a dynamic type of recordset which

allows updates.



from MSDN ADO reference:

Default Result Set 

(SQL Server-specific) 

    A special forward-only/read-only cursor available only with Microsoft SQL

Server. When the server is in this mode, it doesn't wait for the client to

request the data before providing it. Once the cursor has been opened, the

server loads the wire with data; the only overhead involves pulling the data off

the wire. 



Because you don't specify as cursor type, you're not going to be able to write

data.



Charles



____________________Reply Separator____________________

Subject:    [asp_databases] Addnew method Error

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

Date:       18/10/00 16:32



Hi

 I am trying to add the data to a table in SQL SERVER and i get this

error.



ADODB.Recordset error '800a0cb3' 

The operation requested by the application is not supported by the

provider.

/begasp/PrintOrder.asp, line 37 



Here's my code

<%

Dim Conn

Dim rsNextOrder

Dim rsOrder



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

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

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



Conn.Open "DSN=Reliacom;UID=sa;Pwd="

rsNextOrder.Open "tblNextOrder", Conn

rsOrder.Open "tblOrder", Conn  'This the table I want to save records



rsOrder.AddNew   'This is were the error occurs

rsOrder.Fields("OrderNumber") = rsNextOrder("NextOrder")

rsOrder.Fields("RequestedBy") = Request.Form("RequestBy")

rsOrder.Fields("Store") = Request.Form("cboStore")

rsOrder.Fields("Department") = Request.Form("cboDept")

rsOrder.Fields("Reason") = Request.Form("Reason")

rsOrder.Update

%>



I would appreciate the help.

Nisha



Message #3 by Catherine <catherine.s@t...> on Wed, 18 Oct 2000 11:27:30 -0500
Using AddNew is probably not supported by ASP. It's for VB only and not VB 

script. Use rsOrder.AddRecord instead of AddNew.

You should also use the rsOrder.fields.setValue (FIELDNAME, VALUE)  instead 

of  ur existing code or you could create textboxes bounded to the 

recordset's fieldname and assign those textbox with your new values. And 

Don't forget the rsOrder.updateRecord to save the changes.



Hope this helps.



Catherine



rsOrder.AddNew   'This is were the error occurs

rsOrder.Fields("OrderNumber") = rsNextOrder("NextOrder")

rsOrder.Fields("RequestedBy") = Request.Form("RequestBy")

rsOrder.Fields("Store") = Request.Form("cboStore")

rsOrder.Fields("Department") = Request.Form("cboDept")

rsOrder.Fields("Reason") = Request.Form("Reason")

rsOrder.Update





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

From:	Nisha Nambiar [SMTP:nishanam@y...]

Sent:	Wednesday, October 18, 2000 9:32 AM

To:	ASP Databases

Subject:	[asp_databases] Addnew method Error



Hi

 I am trying to add the data to a table in SQL SERVER and i get this

error.



ADODB.Recordset error '800a0cb3'

The operation requested by the application is not supported by the

provider.

/begasp/PrintOrder.asp, line 37



Here's my code

<%

Dim Conn

Dim rsNextOrder

Dim rsOrder



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

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

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



Conn.Open "DSN=Reliacom;UID=sa;Pwd="

rsNextOrder.Open "tblNextOrder", Conn

rsOrder.Open "tblOrder", Conn  'This the table I want to save records



rsOrder.AddNew   'This is were the error occurs

rsOrder.Fields("OrderNumber") = rsNextOrder("NextOrder")

rsOrder.Fields("RequestedBy") = Request.Form("RequestBy")

rsOrder.Fields("Store") = Request.Form("cboStore")

rsOrder.Fields("Department") = Request.Form("cboDept")

rsOrder.Fields("Reason") = Request.Form("Reason")

rsOrder.Update

%>



I would appreciate the help.

Nisha



Message #4 by Nisha Nambiar <nishanam@y...> on Wed, 18 Oct 2000 16:05:46 -0700 (PDT)
Thanks Catherine, I will try that



--- Catherine <catherine.s@t...> wrote:

> Using AddNew is probably not supported by ASP. It's

> for VB only and not VB 

> script. Use rsOrder.AddRecord instead of AddNew.

> You should also use the rsOrder.fields.setValue

> (FIELDNAME, VALUE)  instead 

> of  ur existing code or you could create textboxes

> bounded to the 

> recordset's fieldname and assign those textbox with

> your new values. And 

> Don't forget the rsOrder.updateRecord to save the

> changes.

> 

> Hope this helps.

> 

> Catherine

> 

> rsOrder.AddNew   'This is were the error occurs

> rsOrder.Fields("OrderNumber") 

> rsNextOrder("NextOrder")

> rsOrder.Fields("RequestedBy") 

> Request.Form("RequestBy")

> rsOrder.Fields("Store") = Request.Form("cboStore")

> rsOrder.Fields("Department") 

> Request.Form("cboDept")

> rsOrder.Fields("Reason") = Request.Form("Reason")

> rsOrder.Update

> 

> 

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

> From:	Nisha Nambiar [SMTP:nishanam@y...]

> Sent:	Wednesday, October 18, 2000 9:32 AM

> To:	ASP Databases

> Subject:	[asp_databases] Addnew method Error

> 

> Hi

>  I am trying to add the data to a table in SQL

> SERVER and i get this

> error.

> 

> ADODB.Recordset error '800a0cb3'

> The operation requested by the application is not

> supported by the

> provider.

> /begasp/PrintOrder.asp, line 37

> 

> Here's my code

> <%

> Dim Conn

> Dim rsNextOrder

> Dim rsOrder

> 

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

> set rsNextOrder = Server.CreateObject

> ("ADODB.Recordset")

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

> 

> Conn.Open "DSN=Reliacom;UID=sa;Pwd="

> rsNextOrder.Open "tblNextOrder", Conn

> rsOrder.Open "tblOrder", Conn  'This the table I

> want to save records

> 

> rsOrder.AddNew   'This is were the error occurs

> rsOrder.Fields("OrderNumber") 

> rsNextOrder("NextOrder")

> rsOrder.Fields("RequestedBy") 

> Request.Form("RequestBy")

> rsOrder.Fields("Store") = Request.Form("cboStore")

> rsOrder.Fields("Department") 

> Request.Form("cboDept")

> rsOrder.Fields("Reason") = Request.Form("Reason")

> rsOrder.Update

> %>

> 

> I would appreciate the help.

> Nisha

> 

> 
Message #5 by "Ken Schaefer" <ken@a...> on Thu, 19 Oct 2000 12:25:04 +1000
AddNew is not VB, or VBScript, it is a method of the ADO RecordsetObject.



Since you can instatiate the Recordset object from within VB, or within an

ASP page, the .addNew method is available in both cases.



I'd guess that the error is being caused because the recordset is being

opened with the default adLockReadOnly cursor.



Change the lock type to adLockOptimistic



objRS.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText



Cheers

Ken





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

From: "Catherine" <catherine.s@t...>

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

Sent: Thursday, October 19, 2000 2:27 AM

Subject: [asp_databases] RE: Addnew method Error





> Using AddNew is probably not supported by ASP. It's for VB only and not VB

> script. Use rsOrder.AddRecord instead of AddNew.

> You should also use the rsOrder.fields.setValue (FIELDNAME, VALUE)

instead

> of  ur existing code or you could create textboxes bounded to the

> recordset's fieldname and assign those textbox with your new values. And

> Don't forget the rsOrder.updateRecord to save the changes.

>

> Hope this helps.

>

> Catherine

>

> rsOrder.AddNew   'This is were the error occurs

> rsOrder.Fields("OrderNumber") = rsNextOrder("NextOrder")

> rsOrder.Fields("RequestedBy") = Request.Form("RequestBy")

> rsOrder.Fields("Store") = Request.Form("cboStore")

> rsOrder.Fields("Department") = Request.Form("cboDept")

> rsOrder.Fields("Reason") = Request.Form("Reason")

> rsOrder.Update

>

>

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

> From: Nisha Nambiar [SMTP:nishanam@y...]

> Sent: Wednesday, October 18, 2000 9:32 AM

> To: ASP Databases

> Subject: [asp_databases] Addnew method Error

>

> Hi

>  I am trying to add the data to a table in SQL SERVER and i get this

> error.

>

> ADODB.Recordset error '800a0cb3'

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

> provider.

> /begasp/PrintOrder.asp, line 37

>

> Here's my code

> <%

> Dim Conn

> Dim rsNextOrder

> Dim rsOrder

>

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

> set rsNextOrder = Server.CreateObject ("ADODB.Recordset")

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

>

> Conn.Open "DSN=Reliacom;UID=sa;Pwd="

> rsNextOrder.Open "tblNextOrder", Conn

> rsOrder.Open "tblOrder", Conn  'This the table I want to save records

>

> rsOrder.AddNew   'This is were the error occurs

> rsOrder.Fields("OrderNumber") = rsNextOrder("NextOrder")

> rsOrder.Fields("RequestedBy") = Request.Form("RequestBy")

> rsOrder.Fields("Store") = Request.Form("cboStore")

> rsOrder.Fields("Department") = Request.Form("cboDept")

> rsOrder.Fields("Reason") = Request.Form("Reason")

> rsOrder.Update

> %>

>

> I would appreciate the help.

> Nisha



Message #6 by Adil Hindistan <Adilhn@y...> on Thu, 19 Oct 2000 09:47:54 +0300
Well, we have used AddNew is supported by ASP (tested!). The issue may be

related to security. I have seen similar (or may be the same error) message

when I did not give write access to EVERYONE group.



But, all my experience (which is not much at all) is with Access only.



Adil Hindistan CE-93

scorion@s...

www.scorion.net

ICQ:26477783

 



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

> From: Catherine [mailto:catherine.s@t...]

> Sent: Wednesday, October 18, 2000 7:28 PM

> To: ASP Databases

> Subject: [asp_databases] RE: Addnew method Error

> 

> 

> Using AddNew is probably not supported by ASP. It's for VB 

> only and not VB 

> script. Use rsOrder.AddRecord instead of AddNew.

> You should also use the rsOrder.fields.setValue (FIELDNAME, 

> VALUE)  instead 

> of  ur existing code or you could create textboxes bounded to the 

> recordset's fieldname and assign those textbox with your new 

> values. And 

> Don't forget the rsOrder.updateRecord to save the changes.

> 

> Hope this helps.

> 

> Catherine

> 

> rsOrder.AddNew   'This is were the error occurs

> rsOrder.Fields("OrderNumber") = rsNextOrder("NextOrder")

> rsOrder.Fields("RequestedBy") = Request.Form("RequestBy")

> rsOrder.Fields("Store") = Request.Form("cboStore")

> rsOrder.Fields("Department") = Request.Form("cboDept")

> rsOrder.Fields("Reason") = Request.Form("Reason")

> rsOrder.Update

> 

> 

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

> From:	Nisha Nambiar [SMTP:nishanam@y...]

> Sent:	Wednesday, October 18, 2000 9:32 AM

> To:	ASP Databases

> Subject:	[asp_databases] Addnew method Error

> 

> Hi

>  I am trying to add the data to a table in SQL SERVER and i get this

> error.

> 

> ADODB.Recordset error '800a0cb3'

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

> provider.

> /begasp/PrintOrder.asp, line 37

> 

> Here's my code

> <%

> Dim Conn

> Dim rsNextOrder

> Dim rsOrder

> 

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

> set rsNextOrder = Server.CreateObject ("ADODB.Recordset")

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

> 

> Conn.Open "DSN=Reliacom;UID=sa;Pwd="

> rsNextOrder.Open "tblNextOrder", Conn

> rsOrder.Open "tblOrder", Conn  'This the table I want to save records

> 

> rsOrder.AddNew   'This is were the error occurs

> rsOrder.Fields("OrderNumber") = rsNextOrder("NextOrder")

> rsOrder.Fields("RequestedBy") = Request.Form("RequestBy")

> rsOrder.Fields("Store") = Request.Form("cboStore")

> rsOrder.Fields("Department") = Request.Form("cboDept")

> rsOrder.Fields("Reason") = Request.Form("Reason")

> rsOrder.Update

> %>

> 

> I would appreciate the help.

> Nisha

> 

> 



Message #7 by Ian Nutt <iann@w...> on Thu, 19 Oct 2000 09:06:04 +0100
Nisha and Catherine, 



AFAIK, the AddRecord and SetValue methods (that Catherine mentions here) are

not to be found among the ADO documentation.  Catherine, where did you get

them from?  



Nisha, I believe that your problem lies in this line:  



      rsOrder.Open "tblOrder", Conn  



The Recordset object's .Open method expects five parameters, all of which

are optional.  They are as follows: 



      rsOrder.Open [source], [connection], [cursortype], [locktype],

[options]



If you choose not to specify a parameter value, then ADO uses the default

value instead.  The default cursortype is forward-only, and (crucially here)

the default lock-type is read-only.  In other words, your line of code above

is functionally equivalent to: 



      rsOrder.Open "tblOrder", Conn, adOpenForwardOnly, adLockReadOnly,

adCmdUnknown



And there's the rub.  Your .Open method call returns a readonly recordset,

and you can't add records to a read-only recordset, 'cos it's readonly!

Hence the error message.  



For starters, try this instead: 



      rsOrder.Open "tblOrder", Conn, adOpenStatic, adLockOptimistic,

adCmdTableDirect



(you'll need to ensure these "ad..." constants are defined in your code).

Even better, check the ADO documentation and, in each situation, try to

choose just the right values for those 3rd, 4th and 5th parameters that suit

that situation. 



HTH. 

Regards, Ian

______________________________

Ian Nutt, Wrox Press Ltd

iann@w...   

http://www.wrox.com

http://www.asptoday.com

http://www.wroxconferences.com

http://p2p.wrox.com







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

From: Catherine [mailto:catherine.s@t...]

Sent: Wednesday, October 18, 2000 5:28 PM

To: ASP Databases

Subject: [asp_databases] RE: Addnew method Error





Using AddNew is probably not supported by ASP. It's for VB only and not VB 

script. Use rsOrder.AddRecord instead of AddNew.

You should also use the rsOrder.fields.setValue (FIELDNAME, VALUE)  instead 

of  ur existing code or you could create textboxes bounded to the 

recordset's fieldname and assign those textbox with your new values. And 

Don't forget the rsOrder.updateRecord to save the changes.



Hope this helps.



Catherine



rsOrder.AddNew   'This is were the error occurs

rsOrder.Fields("OrderNumber") = rsNextOrder("NextOrder")

rsOrder.Fields("RequestedBy") = Request.Form("RequestBy")

rsOrder.Fields("Store") = Request.Form("cboStore")

rsOrder.Fields("Department") = Request.Form("cboDept")

rsOrder.Fields("Reason") = Request.Form("Reason")

rsOrder.Update





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

From:	Nisha Nambiar [SMTP:nishanam@y...]

Sent:	Wednesday, October 18, 2000 9:32 AM

To:	ASP Databases

Subject:	[asp_databases] Addnew method Error



Hi

 I am trying to add the data to a table in SQL SERVER and i get this

error.



ADODB.Recordset error '800a0cb3'

The operation requested by the application is not supported by the

provider.

/begasp/PrintOrder.asp, line 37



Here's my code

<%

Dim Conn

Dim rsNextOrder

Dim rsOrder



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

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

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



Conn.Open "DSN=Reliacom;UID=sa;Pwd="

rsNextOrder.Open "tblNextOrder", Conn

rsOrder.Open "tblOrder", Conn  'This the table I want to save records



rsOrder.AddNew   'This is were the error occurs

rsOrder.Fields("OrderNumber") = rsNextOrder("NextOrder")

rsOrder.Fields("RequestedBy") = Request.Form("RequestBy")

rsOrder.Fields("Store") = Request.Form("cboStore")

rsOrder.Fields("Department") = Request.Form("cboDept")

rsOrder.Fields("Reason") = Request.Form("Reason")

rsOrder.Update

%>



I would appreciate the help.

Nisha





Message #8 by Charles.Whinney@i... on Thu, 19 Oct 2000 13:26:03 +0100
AddRecord and Setvalue are Macro Commands in MS Access I believe. 



Charles



____________________Reply Separator____________________

Subject:    [asp_databases] RE: Addnew method Error

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

Date:       19/10/00 09:06



Nisha and Catherine, 



AFAIK, the AddRecord and SetValue methods (that Catherine mentions here) are

not to be found among the ADO documentation.  Catherine, where did you get

them from?  





Message #9 by Nisha Nambiar <nishanam@y...> on Thu, 19 Oct 2000 06:49:30 -0700 (PDT)
Ian

  I tried opening the recordset with adOpenstatic all

other options and also with different lock-types but

didn't make any difference.

What do you mean by ad constants have to be defined in

my code. I don't think I have done sometning like

that.

I would appreciate your reply.

Thanks

Nisha





--- Ian Nutt <iann@w...> wrote:

> Nisha and Catherine, 

> 

> AFAIK, the AddRecord and SetValue methods (that

> Catherine mentions here) are

> not to be found among the ADO documentation. 

> Catherine, where did you get

> them from?  

> 

> Nisha, I believe that your problem lies in this

> line:  

> 

>       rsOrder.Open "tblOrder", Conn  

> 

> The Recordset object's .Open method expects five

> parameters, all of which

> are optional.  They are as follows: 

> 

>       rsOrder.Open [source], [connection],

> [cursortype], [locktype],

> [options]

> 

> If you choose not to specify a parameter value, then

> ADO uses the default

> value instead.  The default cursortype is

> forward-only, and (crucially here)

> the default lock-type is read-only.  In other words,

> your line of code above

> is functionally equivalent to: 

> 

>       rsOrder.Open "tblOrder", Conn,

> adOpenForwardOnly, adLockReadOnly,

> adCmdUnknown

> 

> And there's the rub.  Your .Open method call returns

> a readonly recordset,

> and you can't add records to a read-only recordset,

> 'cos it's readonly!

> Hence the error message.  

> 

> For starters, try this instead: 

> 

>       rsOrder.Open "tblOrder", Conn, adOpenStatic,

> adLockOptimistic,

> adCmdTableDirect

> 

> (you'll need to ensure these "ad..." constants are

> defined in your code).

> Even better, check the ADO documentation and, in

> each situation, try to

> choose just the right values for those 3rd, 4th and

> 5th parameters that suit

> that situation. 

> 

> HTH. 

> Regards, Ian

> ______________________________

> Ian Nutt, Wrox Press Ltd

> iann@w...   

> http://www.wrox.com

> http://www.asptoday.com

> http://www.wroxconferences.com

> http://p2p.wrox.com

> 

> 

> 

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

> From: Catherine [mailto:catherine.s@t...]

> Sent: Wednesday, October 18, 2000 5:28 PM

> To: ASP Databases

> Subject: [asp_databases] RE: Addnew method Error

> 

> 

> Using AddNew is probably not supported by ASP. It's

> for VB only and not VB 

> script. Use rsOrder.AddRecord instead of AddNew.

> You should also use the rsOrder.fields.setValue

> (FIELDNAME, VALUE)  instead 

> of  ur existing code or you could create textboxes

> bounded to the 

> recordset's fieldname and assign those textbox with

> your new values. And 

> Don't forget the rsOrder.updateRecord to save the

> changes.

> 

> Hope this helps.

> 

> Catherine

> 

> rsOrder.AddNew   'This is were the error occurs

> rsOrder.Fields("OrderNumber") 

> rsNextOrder("NextOrder")

> rsOrder.Fields("RequestedBy") 

> Request.Form("RequestBy")

> rsOrder.Fields("Store") = Request.Form("cboStore")

> rsOrder.Fields("Department") 

> Request.Form("cboDept")

> rsOrder.Fields("Reason") = Request.Form("Reason")

> rsOrder.Update

> 

> 

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

> From:	Nisha Nambiar [SMTP:nishanam@y...]

> Sent:	Wednesday, October 18, 2000 9:32 AM

> To:	ASP Databases

> Subject:	[asp_databases] Addnew method Error

> 

> Hi

>  I am trying to add the data to a table in SQL

> SERVER and i get this

> error.

> 

> ADODB.Recordset error '800a0cb3'

> The operation requested by the application is not

> supported by the

> provider.

> /begasp/PrintOrder.asp, line 37

> 

> Here's my code

> <%

> Dim Conn

> Dim rsNextOrder

> Dim rsOrder

> 

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

> set rsNextOrder = Server.CreateObject

> ("ADODB.Recordset")

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

> 

> Conn.Open "DSN=Reliacom;UID=sa;Pwd="

> rsNextOrder.Open "tblNextOrder", Conn

> rsOrder.Open "tblOrder", Conn  'This the table I

> want to save records

> 

> rsOrder.AddNew   'This is were the error occurs

> rsOrder.Fields("OrderNumber") 

> rsNextOrder("NextOrder")

> rsOrder.Fields("RequestedBy") 

> Request.Form("RequestBy")

> rsOrder.Fields("Store") = Request.Form("cboStore")

> rsOrder.Fields("Department") 

> Request.Form("cboDept")

> rsOrder.Fields("Reason") = Request.Form("Reason")

> rsOrder.Update

> %>

> 

> I would appreciate the help.

> Nisha

> 

> 
Message #10 by Catherine <catherine.s@t...> on Thu, 19 Oct 2000 10:06:18 -0500
Hi Guys! I just give suggestions which are also "Tested! "  (AddRecord and 

Setvalue) and its "running and kicking" in our production server.  I have 

used VB also so I fully understand that the code given is really for VB 

code and not VB script..Again, this is based on my "working experience" 

 and not from any sort of ADO documentation that Charles mentioned.

Charles, try to dig more on upper or more immediate ADO documentation or 

shall I say, more basic because when I started diverting from VB to VB 

scripting, that's the first lesson I learned.

Nisha, everything I said is from my experience and not with any long boring 

documentation. After all, you may be more concern if it works not with the 

definition, just a thought. Its not from any documentation, don't ask me 

where did I get them.   :)





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

From:	Charles.Whinney@i... 

[SMTP:Charles.Whinney@i...]

Sent:	Thursday, October 19, 2000 6:26 AM

To:	ASP Databases

Subject:	[asp_databases] Re:RE: Addnew method Error



AddRecord and Setvalue are Macro Commands in MS Access I believe.



Charles



____________________Reply Separator____________________

Subject:    [asp_databases] RE: Addnew method Error

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

Date:       19/10/00 09:06



Nisha and Catherine,



AFAIK, the AddRecord and SetValue methods (that Catherine mentions here) 

are

not to be found among the ADO documentation.  Catherine, where did you get

them from?







Message #11 by Ian Nutt <iann@w...> on Thu, 19 Oct 2000 16:33:53 +0100
Nisha, 



In my previous post, I was talking about constants provided by ADO (whose

names happen to begin with the letters "ad") -- for example,

adOpenForwardOnly, adLockReadOnly and adCmdUnknown in the following line: 



       rsOrder.Open "tblOrder", Conn, adOpenForwardOnly, adLockReadOnly,

adCmdUnknown



The ADO constants are designed to make the code more meaningful to readers

like you and me, and help to prevent errors.  In ADO, adOpenForwardOnly=0,

adLockReadOnly=1 and adCmdUnknown=8, so the following is functionally

equivalent but far less readable: 



       rsOrder.Open "tblOrder", Conn, 0, 1, 8



To define these constants to your ASP pages, choose one of the following

methods: 

(a) Explicitly: e.g. 

	Const adLockReadOnly=1



(b) Include adovbs.inc, which is a file containing all the ADO constant

declarations: 

          <!-- #include file="{insert_filepath}\adovbs.inc" -->

There should be a copy of this file on your hard disk somewhere -- copy it

and use it wherever you like



(c - and recommended by MS these days, I think) Reference the typelib: 

	<!-- metadata type="typelib" file="c:\program files\common

files\system\ado\msado.dll" -->



HTH, Ian

______________________________

Ian Nutt, Wrox Press Ltd

iann@w...   

http://www.wrox.com

http://www.asptoday.com

http://www.wroxconferences.com

http://p2p.wrox.com















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

From: Nisha Nambiar [mailto:nishanam@y...]

Sent: Thursday, October 19, 2000 2:50 PM

To: ASP Databases

Subject: [asp_databases] RE: Addnew method Error





Ian

  I tried opening the recordset with adOpenstatic all

other options and also with different lock-types but

didn't make any difference.

What do you mean by ad constants have to be defined in

my code. I don't think I have done sometning like

that.

I would appreciate your reply.

Thanks

Nisha





--- Ian Nutt <iann@w...> wrote:

> Nisha and Catherine, 

> 

> AFAIK, the AddRecord and SetValue methods (that

> Catherine mentions here) are

> not to be found among the ADO documentation. 

> Catherine, where did you get

> them from?  

> 

> Nisha, I believe that your problem lies in this

> line:  

> 

>       rsOrder.Open "tblOrder", Conn  

> 

> The Recordset object's .Open method expects five

> parameters, all of which

> are optional.  They are as follows: 

> 

>       rsOrder.Open [source], [connection],

> [cursortype], [locktype],

> [options]

> 

> If you choose not to specify a parameter value, then

> ADO uses the default

> value instead.  The default cursortype is

> forward-only, and (crucially here)

> the default lock-type is read-only.  In other words,

> your line of code above

> is functionally equivalent to: 

> 

>       rsOrder.Open "tblOrder", Conn,

> adOpenForwardOnly, adLockReadOnly,

> adCmdUnknown

> 

> And there's the rub.  Your .Open method call returns

> a readonly recordset,

> and you can't add records to a read-only recordset,

> 'cos it's readonly!

> Hence the error message.  

> 

> For starters, try this instead: 

> 

>       rsOrder.Open "tblOrder", Conn, adOpenStatic,

> adLockOptimistic,

> adCmdTableDirect

> 

> (you'll need to ensure these "ad..." constants are

> defined in your code).

> Even better, check the ADO documentation and, in

> each situation, try to

> choose just the right values for those 3rd, 4th and

> 5th parameters that suit

> that situation. 

> 

> HTH. 

> Regards, Ian

> ______________________________

> Ian Nutt, Wrox Press Ltd

> iann@w...   

> http://www.wrox.com

> http://www.asptoday.com

> http://www.wroxconferences.com

> http://p2p.wrox.com

> 

> 

> 

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

> From: Catherine [mailto:catherine.s@t...]

> Sent: Wednesday, October 18, 2000 5:28 PM

> To: ASP Databases

> Subject: [asp_databases] RE: Addnew method Error

> 

> 

> Using AddNew is probably not supported by ASP. It's

> for VB only and not VB 

> script. Use rsOrder.AddRecord instead of AddNew.

> You should also use the rsOrder.fields.setValue

> (FIELDNAME, VALUE)  instead 

> of  ur existing code or you could create textboxes

> bounded to the 

> recordset's fieldname and assign those textbox with

> your new values. And 

> Don't forget the rsOrder.updateRecord to save the

> changes.

> 

> Hope this helps.

> 

> Catherine

> 

> rsOrder.AddNew   'This is were the error occurs

> rsOrder.Fields("OrderNumber") 

> rsNextOrder("NextOrder")

> rsOrder.Fields("RequestedBy") 

> Request.Form("RequestBy")

> rsOrder.Fields("Store") = Request.Form("cboStore")

> rsOrder.Fields("Department") 

> Request.Form("cboDept")

> rsOrder.Fields("Reason") = Request.Form("Reason")

> rsOrder.Update

> 

> 

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

> From:	Nisha Nambiar [SMTP:nishanam@y...]

> Sent:	Wednesday, October 18, 2000 9:32 AM

> To:	ASP Databases

> Subject:	[asp_databases] Addnew method Error

> 

> Hi

>  I am trying to add the data to a table in SQL

> SERVER and i get this

> error.

> 

> ADODB.Recordset error '800a0cb3'

> The operation requested by the application is not

> supported by the

> provider.

> /begasp/PrintOrder.asp, line 37

> 

> Here's my code

> <%

> Dim Conn

> Dim rsNextOrder

> Dim rsOrder

> 

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

> set rsNextOrder = Server.CreateObject

> ("ADODB.Recordset")

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

> 

> Conn.Open "DSN=Reliacom;UID=sa;Pwd="

> rsNextOrder.Open "tblNextOrder", Conn

> rsOrder.Open "tblOrder", Conn  'This the table I

> want to save records

> 

> rsOrder.AddNew   'This is were the error occurs

> rsOrder.Fields("OrderNumber") 

> rsNextOrder("NextOrder")

> rsOrder.Fields("RequestedBy") 

> Request.Form("RequestBy")

> rsOrder.Fields("Store") = Request.Form("cboStore")

> rsOrder.Fields("Department") 

> Request.Form("cboDept")

> rsOrder.Fields("Reason") = Request.Form("Reason")

> rsOrder.Update

> %>

> 

> I would appreciate the help.

> Nisha

> 

> 

Message #12 by Nisha Nambiar <nishanam@y...> on Thu, 19 Oct 2000 13:45:42 -0700 (PDT)
Thanks Ian, I really appreciate your help.

--- Ian Nutt <iann@w...> wrote:

> Nisha, 

> 

> In my previous post, I was talking about constants

> provided by ADO (whose

> names happen to begin with the letters "ad") -- for

> example,

> adOpenForwardOnly, adLockReadOnly and adCmdUnknown

> in the following line: 

> 

>        rsOrder.Open "tblOrder", Conn,

> adOpenForwardOnly, adLockReadOnly,

> adCmdUnknown

> 

> The ADO constants are designed to make the code more

> meaningful to readers

> like you and me, and help to prevent errors.  In

> ADO, adOpenForwardOnly=0,

> adLockReadOnly=1 and adCmdUnknown=8, so the

> following is functionally

> equivalent but far less readable: 

> 

>        rsOrder.Open "tblOrder", Conn, 0, 1, 8

> 

> To define these constants to your ASP pages, choose

> one of the following

> methods: 

> (a) Explicitly: e.g. 

> 	Const adLockReadOnly=1

> 

> (b) Include adovbs.inc, which is a file containing

> all the ADO constant

> declarations: 

>           <!-- #include

> file="{insert_filepath}\adovbs.inc" -->

> There should be a copy of this file on your hard

> disk somewhere -- copy it

> and use it wherever you like

> 

> (c - and recommended by MS these days, I think)

> Reference the typelib: 

> 	<!-- metadata type="typelib" file="c:\program

> files\common

> files\system\ado\msado.dll" -->

> 

> HTH, Ian

> ______________________________

> Ian Nutt, Wrox Press Ltd

> iann@w...   

> http://www.wrox.com

> http://www.asptoday.com

> http://www.wroxconferences.com

> http://p2p.wrox.com

> 

> 

> 

> 

> 

> 

> 

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

> From: Nisha Nambiar [mailto:nishanam@y...]

> Sent: Thursday, October 19, 2000 2:50 PM

> To: ASP Databases

> Subject: [asp_databases] RE: Addnew method Error

> 

> 

> Ian

>   I tried opening the recordset with adOpenstatic

> all

> other options and also with different lock-types but

> didn't make any difference.

> What do you mean by ad constants have to be defined

> in

> my code. I don't think I have done sometning like

> that.

> I would appreciate your reply.

> Thanks

> Nisha

> 

> 

> --- Ian Nutt <iann@w...> wrote:

> > Nisha and Catherine, 

> > 

> > AFAIK, the AddRecord and SetValue methods (that

> > Catherine mentions here) are

> > not to be found among the ADO documentation. 

> > Catherine, where did you get

> > them from?  

> > 

> > Nisha, I believe that your problem lies in this

> > line:  

> > 

> >       rsOrder.Open "tblOrder", Conn  

> > 

> > The Recordset object's .Open method expects five

> > parameters, all of which

> > are optional.  They are as follows: 

> > 

> >       rsOrder.Open [source], [connection],

> > [cursortype], [locktype],

> > [options]

> > 

> > If you choose not to specify a parameter value,

> then

> > ADO uses the default

> > value instead.  The default cursortype is

> > forward-only, and (crucially here)

> > the default lock-type is read-only.  In other

> words,

> > your line of code above

> > is functionally equivalent to: 

> > 

> >       rsOrder.Open "tblOrder", Conn,

> > adOpenForwardOnly, adLockReadOnly,

> > adCmdUnknown

> > 

> > And there's the rub.  Your .Open method call

> returns

> > a readonly recordset,

> > and you can't add records to a read-only

> recordset,

> > 'cos it's readonly!

> > Hence the error message.  

> > 

> > For starters, try this instead: 

> > 

> >       rsOrder.Open "tblOrder", Conn, adOpenStatic,

> > adLockOptimistic,

> > adCmdTableDirect

> > 

> > (you'll need to ensure these "ad..." constants are

> > defined in your code).

> > Even better, check the ADO documentation and, in

> > each situation, try to

> > choose just the right values for those 3rd, 4th

> and

> > 5th parameters that suit

> > that situation. 

> > 

> > HTH. 

> > Regards, Ian

> > ______________________________

> > Ian Nutt, Wrox Press Ltd

> > iann@w...   

> > http://www.wrox.com

> > http://www.asptoday.com

> > http://www.wroxconferences.com

> > http://p2p.wrox.com

> > 

> > 

> > 

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

> > From: Catherine [mailto:catherine.s@t...]

> > Sent: Wednesday, October 18, 2000 5:28 PM

> > To: ASP Databases

> > Subject: [asp_databases] RE: Addnew method Error

> > 

> > 

> > Using AddNew is probably not supported by ASP.

> It's

> > for VB only and not VB 

> > script. Use rsOrder.AddRecord instead of AddNew.

> > You should also use the rsOrder.fields.setValue

> > (FIELDNAME, VALUE)  instead 

> > of  ur existing code or you could create textboxes

> > bounded to the 

> > recordset's fieldname and assign those textbox

> with

> > your new values. And 

> > Don't forget the rsOrder.updateRecord to save the

> > changes.

> > 

> > Hope this helps.

> > 

> > Catherine

> > 

> > rsOrder.AddNew   'This is were the error occurs

> > rsOrder.Fields("OrderNumber") 

> > rsNextOrder("NextOrder")

> > rsOrder.Fields("RequestedBy") 

> > Request.Form("RequestBy")

> > rsOrder.Fields("Store") = Request.Form("cboStore")

> > rsOrder.Fields("Department") 

> > Request.Form("cboDept")

> > rsOrder.Fields("Reason") = Request.Form("Reason")

> > rsOrder.Update

> > 

> > 

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

> > From:	Nisha Nambiar [SMTP:nishanam@y...]

> > Sent:	Wednesday, October 18, 2000 9:32 AM

> > To:	ASP Databases

> > Subject:	[asp_databases] Addnew method Error

> > 

> > Hi

> >  I am trying to add the data to a table in SQL

> > SERVER and i get this

> > error.

> > 

> > ADODB.Recordset error '800a0cb3'

> > The operation requested by the application is not

> 

=== message truncated ===







Message #13 by "Ken Schaefer" <ken@a...> on Fri, 20 Oct 2000 15:18:42 +1000
Try here:



http://www.adopenstatic.com/faq/800a0bb9step2.asp



Cheers

Ken



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

From: "Nisha Nambiar" <nishanam@y...>

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

Sent: Thursday, October 19, 2000 11:49 PM

Subject: [asp_databases] RE: Addnew method Error





> Ian

>   I tried opening the recordset with adOpenstatic all

> other options and also with different lock-types but

> didn't make any difference.

> What do you mean by ad constants have to be defined in

> my code. I don't think I have done sometning like

> that.

> I would appreciate your reply.

> Thanks

> Nisha




  Return to Index