troubleshooting Question

ASP.Net - Easy question CSV read comma

Avatar of sbornstein2
sbornstein2 asked on
3 Comments1 Solution531 ViewsLast Modified:
Hello all,

I have the following code and the split is finding the extra comma it looks like in the row like this how do I handle this.  File has 9 columns 0-8  Row example:

[2]: "AE,1,VARIABLE,ID,SD0058,\"Variable appears in dataset, but is not in SDTM standard\",Metadata,Warning,"

Code is:
  // create new datatable
        DataTable dt = new DataTable();

        // get the column header means first line
        string[] temp = str[0].Split(',');

        // creates columns of gridview as per the header name
        foreach (string t in temp)
            dt.Columns.Add(t, typeof(string));

        // now retrive the record from second line and add it to datatable
        for (int i = 1; i < str.Length; i++)
            string[] t = str[i].Split(',');

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros