Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 1st, 2006, 02:22 AM
Authorized User
 
Join Date: Sep 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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??

Reply With Quote
  #2 (permalink)  
Old February 1st, 2006, 07:25 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

Reply With Quote
  #3 (permalink)  
Old February 1st, 2006, 09:49 AM
Authorized User
 
Join Date: Sep 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Reply With Quote
  #4 (permalink)  
Old February 1st, 2006, 10:54 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

HTH,

Chris

Reply With Quote
  #5 (permalink)  
Old February 1st, 2006, 01:01 PM
Authorized User
 
Join Date: Sep 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


Reply With Quote
  #6 (permalink)  
Old February 1st, 2006, 01:09 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.

Reply With Quote
  #7 (permalink)  
Old February 1st, 2006, 06:48 PM
Authorized User
 
Join Date: Sep 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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




Reply With Quote
  #8 (permalink)  
Old February 2nd, 2006, 04:55 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command text was not set for the command object Sheraz Khan Classic ASP Databases 2 May 29th, 2007 12:57 AM
Chap 5 - CommandType.Text vs. TableDirect RBrown BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 August 3rd, 2006 06:24 AM
Command text was not set for the command object. deepa12 BOOK: Beginning ASP 3.0 5 November 2nd, 2004 05:37 PM
Help! 'Command object error' sisi Classic ASP Databases 4 May 25th, 2004 06:23 PM



All times are GMT -4. The time now is 09:09 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.