Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
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 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 May 9th, 2005, 02:14 PM
Registered User
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default String legnth too long???

I have a Stored proc that has a “@cityList varchar(2000) = null“ as an input parm.

It is querying a table thus:
            Declare @SQL varchar(1000)

            SELECT @SQL = ‘SELECT producerID, ProducerName from tblProducers where City IN (‘ + cityList +’)’

            Exec (@SQL)

All is well and good if I pass in “’Montgomery’, ‘Birmingham’, ‘Atlanta’”. However, if I try to pass in a string with more than 128 characters, it gives me “The identifier that starts with <LONG STRING CUT OUT> is too long. Maximum length is 128.”

Is there any way to pass in my cityList if it's greater than 128 characters?


 
Old May 10th, 2005, 10:51 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please change the double quotes to single quotes. I think u are using double quotes when passing parameters to this SP.


Om Prakash
 
Old May 11th, 2005, 07:25 AM
Registered User
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for the reply, I was starting to loose hope. :)

Actually, I'm passing the parms like this:

 
Quote:
quote:command.CommandType = CommandType.StoredProcedure;
Quote:


command.CommandText = "spGetPickListProducers";

command.Parameters.Add("@cityList", SqlDbType.VarChar,2000);
command.Parameters["@cityList"].Value = cityParm.ToString();

con.Open();

SqlDataReader reader = command.ExecuteReader();
 
Old May 12th, 2005, 07:07 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

First of all see the lines
Quote:
quote:
"@cityList varchar(2000) = null“ as an input parm.

It is querying a table thus:
            Declare @SQL varchar(1000)
@cityList is 2000
@SQL is 1000 -> make it 4000

Fix It first

Prashant

 
Old May 12th, 2005, 07:13 AM
Registered User
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Already done, actually. Result is the same.

 
Old May 24th, 2005, 08:47 AM
Registered User
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Any other suggestions?

 
Old September 24th, 2013, 04:16 PM
Registered User
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Talking Future-Sithlrd handled it... Ha!

Finally got around to refactoring this app... 8 years later, my kids are driving age and I'm still coding. LOL... it's now done in LINQ with like 5 lines.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to split a long string with tab delimited Andraw SQL Server 2005 27 July 17th, 2008 05:38 PM
how long can a string be? JesseM C# 0 July 5th, 2006 03:29 PM
string to "long long" without using atoll sarraju C++ Programming 2 August 4th, 2004 07:19 AM
Query String Too Long....Max Length Error Message phungleon Classic ASP Databases 14 May 28th, 2004 12:25 PM
Modifying long text in a long field sajsal Classic ASP Databases 1 February 20th, 2004 12:36 PM





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