.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Double Quotes in CSV File

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :Sql Server

I have a lot of data coming in from CSV files.  I have many CSV files (~20), with varying amounts of data- but some are quite large (largest file is ~230mb)

I'm trying to import it into a SQL database via SSIS, but the data is a little bit frustrating. 

I have data that looks like this:

"Text from vendor ""Vendor Name, Inc."" blah blah", "Next string", "", 1234

Many things to notice here - as well you can imagine some of the difficulties here.

After parsing, this data should have 4 columns-

Column1                                                                          Column2              Column3               Column4

Text From Vendor "Vendor Name, Inc." blah blah      Next string            <blank>    

View Complete Post

More Related Resource Links

two adjacent double quotes in json causes blue screen by JavaScriptSerializer

Hello, I am using System.Web.Script.Serialization.JavaScriptSerializer to deserialize  http requests.  I get the blue screen when the contents I am deserializing has two double quotes, for example:  ""country"". Is there a fix for this?  Currently I replace the "" with a special string and then I deserialization, then I put back the "".  I do this for a given field in the object which I've seen comes in with ""s.  The problem is that I should be doing this for all fields in the input json.  This is a lot of extra code to write as I could be deserializing many different types of Json objects.  The "" is needed by the client to specify a quoted string, so I can't ask for the input to be changed. Any help on this subject would be really appreciated. Many thanks.     I am using .Net framework 3.5.

OpenDialog box to open file with a double-mouse click

Hi, I am having a hard time trying to find an example that opens an opendialog box and allows the users to open the file with a Double-Click. Please help.   Thanks

Unbalanced Double Quotes " in CSV Generated From Reporting Services 2008

I have a data driven subscription which runs a reporting services report and generates the results as a csv file.

One of the field values inlcudes a double quote : Bread Tortilla Flour 10".

In SSRS 2005 this is correctly extracted to the csv as "Bread Tortilla Flour 10""". That is the value is placed in double quotes and the double quote itself is balanced with a second.

In SSRS 2008 this is extracted as "Bread Tortilla Flour 10"" which leaves an unblanced quote and makes the rest of the file unreadable.

Is this a bug - or do we have an incorrect setting. The report has been migrated directly from 2005 to 2008.

SQL file will not open in SSMS on double-click (or jump list)


Hello, all.

I am running SQL Server Management Studio 2008 on a Windows 7 Enterprise machine here at work.  I am not sure when this started happening, but now, for some reason, when I double-click on a SQL file in Explorer, or from the jump list for SSMS (which I have pinned to my Windows 7 task bar), SSMS will open, but will not load the file in question, nor will it bring up a logon screen to connect to a DB.  I tried unassociating the .SQL extension and then re-associating it using "Open With" and it worked the first time (from the Open With), but then immediately reverted back to its old behavior.  Very annoying.

For now I just open SSMS first (which pops up a logon screen and things proceed normally), but that kind of defeats the purpose of having a jump list or a file association.  Has anybody run into this before and can anybody suggest a fix or what's wrong?

Thanks in advance for any wisdom anyone can provide. 

Allowing double quotes in URL


Hi all,

I'm trying to get my URLs to contain double quotes (") and other special characters such as <, > etc in my MVC2 application. Here's an example:


The above would throw up a System.ArgumentException: Illegal characters in path.

Any chances that this can be done?

ODBC text driver doesn't read columns containing double quotes



I'm having some trouble with importing some information from a delimited text file into an SQL database. I made a DSN for the file using the  Microsoft ODBC driver. It reads most of the data fine. I can get most of it into the database, or using Excel I can display it in a table.

This is a regular text file, the delimiter is a "|" character. Some of the data has double quotes embedded in it. Every time it hits one of these double quotes, the rest of the information on that line are ignored.Then it will move on to the next line in the file.

Is there a way to set up the driver to read these quotes somehow, or to just ignore them?

Double click an associated file type and have it open in your WPF application?


I have a WPF application that does a number of things. When running the app, I can go to File > Open, browse to a file, and open it in the app. Fields on the UI are updated with values from the file and everything works great.

The file I am opening contains binary data and has a custom file extension that is associated with my application. The problem is that if I DON'T have the WPF application running and I double click one of my associated files, it simply opens the application. I would like it to open the application and then load the contents of the file I clicked on. How can I go about doing this?

I have looked into using the Application_Startup event handler in the App.xaml.cs but cannot get the filename when double clicking on it as my StartupEventArgs are empty. However, the sender.ToString from Application_Startup handler returns "MyCompany.MyApp.App". How can I get the filename and go about loading it?

Another thing is that if I put a breakpoint in the Application_Startup event handler and double click my associated file, I never hit the breakpoint. The only way I hit the breakpoint is when I run the application from the IDE. I would like to be able to double click a file, then hit the breakpoint so I can do some debugging.

Thanks in advance.

Embedded quotes in CSV file - Flat file import

I have embedded double quotes in one of columns of my CSV file. E.g (see 2nd line) "Sateesh","Maduri",1,M "S""Folk", "M",1,M And as we dont have direct configuration properties for this type of flat files while importing into sql server, I have used the example given in http://www.ideaexcursion.com/2008/11/12/handling-embedded-text-qualifiers/ , but I am getting the error "value of type string cannot be converted to Microsoft.SqlServer.Dts.Pipeline.BlobColumn'. I have one column as Text column which have embedded double quotes in it. Please help me as soon as possible.
Sateesh Maduri

Export from Visual Studio 2005 CSV File with all elements double quoted

How can I get double quotes around all fields in a csv file?  Export creates file with no quotes.

Using Double Quotes in a string


string  script = @" $(document).ready(function () { ";
                            script += @" $(#headerTop).css('background-color', " + color + "});";

I want to put #headerTop in double quotes. How to do that ?


Search string (in txt file) --> Get the string between quotes which comes after it --> Add item in l


Hello :)

I've mentioned my complete objective in the title.

I already know how to find a string, and add a item in listbox.
But so far I kept failing at retreiving the string between the quotes

My txt file looks like this:

List of delicious fruits ( Index 1 "Apple") ( Index 2 "Cherry") ( Index 3 "Banana") (...) (...)

The listbox has to view this :

Apple Cherry Banana

This is how far I got.

public void fruitFinderBlock()
 StreamReader reader = new StreamReader(@"C:\TEST.txt");
 string content = reader.ReadToEnd();
 while (content != null) // while not at end of file
 string Find = "Index";
 if (content == Find)
 string fruitname;

 // TODO assign fruitname to the string between the quotes 

Undetermined literal error when a value contains double quotes


Hi I need to pass some information in a javascript function when an image link is clicked in a datagrid.  When values in a certain column called 

itemcode contain double quotes then I get the subject error. Is there any way to get rid of the double quotes in this line directly

'<%#Eval("ItemCode")%>' ?

Here is the full code:

                <img style="border:0" 

File Splitter in .Net

I love to do utility programs in .Net. And this is one of them. As I was playing with JSplit (a free file splitter program), I wondered if I could do it in .Net. The framework supports file operations like reading files in bytes and creating them. It is indeed easy to do file operations in .Net Basics on File operations

Upload Multiple File using JQuery in asp.net

In this article I have explained how to upload multiple files using file upload control. I have used jQuery plugin for uploading multiple files.

I have also explained how to check for file type, file maximum size limit using jQuery & also using server side validation code.

Creating Excel file from C#

I used below coding for create a excel sheet.I got from on web site.
In below coding there is no problem.Its create the excel file.If i run second time,its ask to overwrite the current excel file.If I said "Yes" then it ok ,but If I select cancel button,its generate the Error message.The exception is

Upload a File to a SharePoint Document Library - Part I

The following helper class demonstrates a few techniques that allow documents to be uploaded to a SharePoint document library programmatically without using the API or a custom web service. You don't need to specify a document library name, and it will create any folders specified in the URL as required. File meta data will be updated if any properties are passed.

SmtpClient and Locked File Attachments

Got a note a couple of days ago from a client using one of my generic routines that wraps SmtpClient. Apparently whenever a file has been attached to a message and emailed with SmtpClient the file remains locked after the message has been sent. Oddly this particular issue hasn't cropped up before for me although these routines are in use in a number of applications I've built.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend