Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 9th, 2005, 03:14 PM
Registered User
Points: 36, Level: 1
Points: 36, Level: 1 Points: 36, Level: 1 Points: 36, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: Birmingham, AL, USA.
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?


Reply With Quote
  #2 (permalink)  
Old May 10th, 2005, 11:51 PM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
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
Reply With Quote
  #3 (permalink)  
Old May 11th, 2005, 08:25 AM
Registered User
Points: 36, Level: 1
Points: 36, Level: 1 Points: 36, Level: 1 Points: 36, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: Birmingham, AL, USA.
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();
Reply With Quote
  #4 (permalink)  
Old May 12th, 2005, 08:07 AM
Friend of Wrox
 
Join Date: Apr 2005
Location: Cochin, , India.
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

Reply With Quote
  #5 (permalink)  
Old May 12th, 2005, 08:13 AM
Registered User
Points: 36, Level: 1
Points: 36, Level: 1 Points: 36, Level: 1 Points: 36, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: Birmingham, AL, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Already done, actually. Result is the same.

Reply With Quote
  #6 (permalink)  
Old May 24th, 2005, 09:47 AM
Registered User
Points: 36, Level: 1
Points: 36, Level: 1 Points: 36, Level: 1 Points: 36, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: Birmingham, AL, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Any other suggestions?

Reply With Quote
  #7 (permalink)  
Old September 24th, 2013, 05:16 PM
Registered User
Points: 36, Level: 1
Points: 36, Level: 1 Points: 36, Level: 1 Points: 36, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: Birmingham, AL, USA.
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.
Reply With Quote
Reply


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
How to split a long string with tab delimited Andraw SQL Server 2005 27 July 17th, 2008 06:38 PM
how long can a string be? JesseM C# 0 July 5th, 2006 04:29 PM
string to "long long" without using atoll sarraju C++ Programming 2 August 4th, 2004 08:19 AM
Query String Too Long....Max Length Error Message phungleon Classic ASP Databases 14 May 28th, 2004 01:25 PM
Modifying long text in a long field sajsal Classic ASP Databases 1 February 20th, 2004 12:36 PM



All times are GMT -4. The time now is 01:06 PM.


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