Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET 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 June 3rd, 2006, 02:50 AM
Friend of Wrox
 
Join Date: Apr 2006
Location: , , .
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default why different syntaxes for 'Command'?

Hi,

I saw three different syntaxes in command lines:
UpdateCommand="UPDATE [mytable] SET [name] = @name ...
UpdateCommand="Update `mytable` set `name`=? ...
UpdateCommand="UPDATE [mytable] SET [name] = ? ...

Does the three do the same?
Why those differences?
Thanks


Reply With Quote
  #2 (permalink)  
Old June 3rd, 2006, 02:57 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi hertendreef,

It depends on the data source you're using. The ? will work with databases like Access, while the @name works with SQL Server.

The [] are used to enclose database objects that have (semi) invalid names, containing reserved words or spaces. Enclosing the name in [] tells the database to take the text between them as literal text.

I am not sure if your second example works; may work on other databases...

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Reply With Quote
  #3 (permalink)  
Old June 5th, 2006, 07:51 AM
Friend of Wrox
 
Join Date: Apr 2006
Location: , , .
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks

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
Insert command rajanikrishna ASP.NET 1.0 and 1.1 Basics 0 April 3rd, 2006 08:47 AM
Command Builder BSkelding ASP.NET 1.0 and 1.1 Professional 3 April 18th, 2005 12:03 PM
Command text was not set for the command object. deepa12 BOOK: Beginning ASP 3.0 5 November 2nd, 2004 05:37 PM



All times are GMT -4. The time now is 03:43 PM.


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