Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics 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 February 12th, 2008, 11:39 AM
Authorized User
 
Join Date: Dec 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error - sqlparameter

I am getting and error that reads:

An SqlParameter with ParameterName 'CASE_LNAME' is not contained by this SqlParameterCollection.

This error is generated in my code area:
LookUpSqlDataAdapter.SelectCommand.Parameters.Item ("CASE_LNAME").Value = lastName

Please help.

 
Old February 12th, 2008, 01:14 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

If I were you, I would find out the name of all the parameters. You should be able to provide a number as the argument to .item(). So 1 by 1, list .Item(n).Name.

There probably isn’t one named “CASE_LNAME.”
 
Old February 13th, 2008, 04:08 AM
Authorized User
 
Join Date: Dec 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello BrianWren

I used hdcmd.Parameters.Add("@CASE_LNAME", SqlDbType.VarChar, 50).Value = lastName

where the hdcmd is SqlCommand and it worked.

I get a new error which reads " Login failed for user 'sa' "
This happens when i try filling a dataadapter.
Below is the code:

hdcmd.Parameters.Add("@CASE_LNAME", SqlDbType.VarChar, 50).Value = lastName
LookUpDataSet3.Clear()
LookUpSqlDataAdapter.Fill(LookUpDataSet3)


Please help


 
Old February 13th, 2008, 03:43 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I presume the username or password is not right (wrong case, typo, whatever).





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected T_ELSE in /h vipin k varghese BOOK: XSLT Programmer's Reference, 2nd Edition 4 September 29th, 2011 01:19 AM
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
IDataParameter() instead of SqlParameter() organicglenn BOOK: ASP.NET Website Programming Problem-Design-Solution 0 March 25th, 2004 12:39 AM





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