p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   Command Object - commandType error (http://p2p.wrox.com/showthread.php?t=37857)

europhreak February 1st, 2006 02:22 AM

Command Object - commandType error
I'm using command object and everytime I declare it like so:

objCommand.CommandType = adCmdText


objCommand.CommandType = adCmdTable

I get an error. but without it, it works fine. how come??

ChrisScott February 1st, 2006 07:25 AM

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?



europhreak February 1st, 2006 09:49 AM

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.

ChrisScott February 1st, 2006 10:54 AM

adCmdText and adCmdTable are ADO constants, if you don't reference or declare them in your page you will get errors.



europhreak February 1st, 2006 01:01 PM

see the problem is that when i DO NOT specify them it works fine, when i DO specify i get an error.

ChrisScott February 1st, 2006 01:09 PM

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.

europhreak February 1st, 2006 06:48 PM

ok, got it working. simply added this on top of the page:

ChrisScott February 2nd, 2006 04:55 AM

Excellent, so all you needed to do was add the constants after all :D

All times are GMT -4. The time now is 08:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.