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
171 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 62

Accepted Solution

by:
Fernando Soto earned 500 total points
Comment Utility
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
Comment Utility
That was perfect Fernando. I guess I need to review all the string methods. :)
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Glad I was able to help.  ;=)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now