Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Visual Basic 2008 ISBN: 978-0-470-19136-1
This is the forum to discuss the Wrox book Professional Visual Basic 2008 by Bill Evjen, Billy Hollis, Bill Sheldon, Kent Sharkey; ISBN: 9780470191361
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Visual Basic 2008 ISBN: 978-0-470-19136-1 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 August 12th, 2010, 03:58 PM
Registered User
 
Join Date: Jul 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default BuildSqlCommand

I tried to use the add parameters routine described in chapter 9 page 346
my example is below. The program returns indicating my first parameter is missing, although the parameter count is correct. Is the second parameter overwriting?

Code:
        Dim cmd As SqlCommand = New SqlCommand(uspGroupXref, connSql)
        cmd.CommandType = CommandType.StoredProcedure
        Dim parameter As SqlParameter = Nothing
        parameter = New SqlParameter
        parameter.ParameterName = "@sBCAPartner"
        parameter.SourceColumn = sBCAPartner
        cmd.Parameters.Add(parameter)
        parameter = New SqlParameter
        parameter.ParameterName = "@sLabAcctNbr"
        parameter.SourceColumn = sLabAcctNbr
        cmd.Parameters.Add(parameter)
        cmd.Connection.Open()
        Dim myreader As SqlDataReader

        Dim returndata As String = ""
        myreader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
  #2 (permalink)  
Old August 18th, 2010, 02:14 PM
Registered User
 
Join Date: Jul 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Saw what I did wrong. I wanted to do an Add(new sqlparameter ..) and not a new sqlparameter.
 


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



All times are GMT -4. The time now is 10:14 PM.


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