Wrox Programmer Forums
|
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 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
 
Old April 7th, 2004, 10:31 AM
Registered User
 
Join Date: Apr 2004
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
 
Old October 9th, 2004, 05:56 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
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





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 08: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 08:43 PM
OleDbCommand Problems FalseParadigm VB Databases Basics 8 April 10th, 2007 03: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





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