Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003
This is the forum to discuss the Wrox book Professional VB.NET 2003 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Jonathan Pinnock, Rama Ramachandran, Bill Sheldon; ISBN: 9780764559921
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 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
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 7th, 2004, 11:31 AM
Registered User
 
Join Date: Apr 2004
Location: Ferrara, , Italy.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to AleBernardi Send a message via MSN to AleBernardi
Default VB.NET - oledbcommand.parameters BUG

Hi!
in the book VB.NET of M.Reynolds, R.Blair, J.Crossland, T.Willis there's probably a "bug" about how to set parameters in a OleDbCommand.CommandText property.

vb doesn't care about the parameter name but just about the sequence of the paramenter array. the sample code works fine, but it's a lucky case.

Book's code:
---------------------------------------------------------
myCommand.CommandText = "INSERT INTO authors (au_id, au_lname, au_fname, contract) " & _
                        "VALUES(@au_id,@au_lname,@au_fname,@contract)"
myCommand.Parameters.Add("@au_id", txtAuId.Text)
myCommand.Parameters.Add("@au_lname", txtLastName.Text)
etc...
---------------------------------------------------------

But if you try to exchange parameters,
---------------------------------------------------------
myCommand.Parameters.Add("@au_lname", txtLastName.Text)
myCommand.Parameters.Add("@au_id", txtAuId.Text)
etc...
---------------------------------------------------------

the database field are filled wrong, with the exchanged fields!

I have VS.NET Pro 2003 italian Service Packed and I think that it's a vb bug not reported in the book.

Am I wrong?
any suggestion?
Thanks you mouch!

(the book is very good I like it much) :)

bye


Alessandro Bernardi
BBros snc
  #2 (permalink)  
Old October 9th, 2004, 06:56 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Parameters need to be added to the Parameters collection in the order in which they are defined in either your in-line SQL statements or the stored procedure that you are using.

Thearon
 


Thread Tools
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
Forum Caching Bug in VB Code Scott663 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 March 27th, 2008 09:24 PM
Bug in the Poll VB code? thuyvncr BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 April 21st, 2007 09:43 PM
OleDbCommand Problems FalseParadigm VB Databases Basics 8 April 10th, 2007 04:01 PM
Bug or no to bug learning C using VS.Net to compil tesh All Other Wrox Books 0 February 14th, 2007 01:06 PM



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


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