Solved

Need to send a list of workstations to a SQL SP / its variable, but need to remove /r/n

Posted on 2009-04-05
3
175 Views
Last Modified: 2013-12-17
I'm testing a list of workstations that will be sent as comma delimited to a SQL 2005 SP whereby the @Workstation variable will receive this list.
I went to copy and past some workstations from an Excel sheet and when I went to add this list to the Properties/Debug/Command line arguments box, and went to store them in an array,
I noticed that the workstations in the arrary were being list like this:
B001617259BA7,\r\nB001E371E21B2,\r\nB001422C95811,\r\nB001C25100C31,\r\nB001422D9BE9B,\r\nB00217091E3A0,etc. What methods are there to remove the Newline \r\n Escape sequence characters before adding them into VS 2008 for Debug testing or when sent to the SP?
Thanks for your help Experts,
Wally
[0] = "B001617259BA7,\r\nB001E371E21B2,\r\nB001422C95811,\r\nB001C25100C31,\r\nB001422D9BE9B,\r\nB00217091E3A0,\r\nB0015605A5819,\r\nB00163666A181,\r\nB0021709A9EF8,\r\nB001C23525C6B,\r\nB00188BD375BF,\r\nB0016179FBF81,\r\nB001C25143F9D,\r\nB0014C2CA6C1F,\r\nB001...

Open in new window

0
Comment
Question by:wally_davis
  • 2
3 Comments
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 24074160
Hi wally_davis;

This will do what you need.

Fernando
string Workstation = "B001617259BA7,\r\nB001E371E21B2,\r\nB001422C95811,\r\nB001C25100C31,\r\nB001422D9BE9B,\r\nB00217091E3A0,\r\nB0015605A5819,\r\nB00163666A181,\r\nB0021709A9EF8,\r\nB001C23525C6B,\r\nB00188BD375BF,\r\nB0016179FBF81,\r\nB001C25143F9D,\r\nB0014C2CA6C1F,\r\nB001";
Workstation = Workstation.Replace("\r\n", String.Empty);

Open in new window

0
 

Author Closing Comment

by:wally_davis
ID: 31566861
That was perfect Fernando. I guess I need to review all the string methods. :)
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 24083742
Glad I was able to help.  ;=)
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question