 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 1st, 2006, 02:22 AM
|
|
Authorized User
|
|
Join Date: Sep 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Command Object - commandType error
I'm using command object and everytime I declare it like so:
objCommand.CommandType = adCmdText
OR
objCommand.CommandType = adCmdTable
I get an error. but without it, it works fine. how come??
|
|

February 1st, 2006, 07:25 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi europhreak,
What type of command are you executing - sql query / stored proc / table opening?
Have you got a reference to the ADO constants in your page?
Cheers,
Chris
|
|

February 1st, 2006, 09:49 AM
|
|
Authorized User
|
|
Join Date: Sep 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i'm using access database with one table. in the book beggining asp 3.0 they're only specifying constants with a CONNECTION object but not with Command object.
|
|

February 1st, 2006, 10:54 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
adCmdText and adCmdTable are ADO constants, if you don't reference or declare them in your page you will get errors.
HTH,
Chris
|
|

February 1st, 2006, 01:01 PM
|
|
Authorized User
|
|
Join Date: Sep 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
see the problem is that when i DO NOT specify them it works fine, when i DO specify i get an error.
|
|

February 1st, 2006, 01:09 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
That is beacuse if you do not specify a CommandType ADO works out which type of CommandType to use, this will take longer than specifying the correct CommandType to start with.
If you pass it a CommandType for example adCmdText without defining the ADO constants first you will be passing an empty variant to the property causing an error.
|
|

February 1st, 2006, 06:48 PM
|
|
Authorized User
|
|
Join Date: Sep 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ok, got it working. simply added this on top of the page:
|
|

February 2nd, 2006, 04:55 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Excellent, so all you needed to do was add the constants after all :D
|
|
 |