I have an asp.net web page that a user is loading a file to that I want to parse data out of. The following text is some sample data (I'm told that it's supposed to be .csv but as you can tell, it's really not.)

Resource:Wills MD, Robert P; Ward LPC LSOTP, Tracy K; Wages MD, John; von Leonrod FNP C, Sara; Teague PA C, Donna; Prewitt Buchanan MD, Laura K; NO - Medical Assistant; NO - C2 Pickup; Morgan FNP C, Nancy; Minot APRN, S. Reid; Medical Assistants; Martin LCSW, Margaret; Lepore MA LPC, Bruno; Iseminger PA C, Amy C; Intern; Horwath PA C, Jessica; Hart PA C, Mary Jo; Haden LCSW, Marion M; Group Services; Frank MD, Brannon R; DuBois MD, Craig; Chandler LCSW, Michele; C2 Pickup - Main Office; Brothers LCSW, Gary; Bates FNP C, Gina; Anderson MD, Christine
Facility:Austin Pain Associates - North Office; Austin Pain Associates - Kyle; Austin Pain Associates - Georgetown; Austin Pain Associates - Cedar Park; Austin Pain Associates
Type:(all)
From Date: 07/12/2010 - To Date 07/12/2010
Sort by:Time
Include Referring source/physician:No
Footer:Default
Criteria:None
","Appointments","Brothers LCSW, Gary","Austin Pain Associates","Monday, July 12, 2010","Time","Patient Name","Patient ID","Appt. Type","Ref. Source/ Physician","Phone","Type","DOB ","Brothers LCSW, Gary","Austin Pain Associates","7/12/2010 12:00:00AM","Time","Patient Name","Patient ID","Appt. Type","Phone","Type","DOB "," 7:30 AM","Muniz Jr, Reynaldo A","27380","SO - Ind Psych Therapy - 45","","(512) 740-7023","Mobile","03/25/1965"," 7:30 AM","Muniz Jr, Reynaldo A","27380","SO - Ind Psych Therapy - 45","(512) 740-7023","Mobile","03/25/1965","Truong, Kimphuong P","(512) 836-5472","Financial Class:","Medicare","Status:","Auth Complete","","","Age:","45 yrs","Notes:","counseling - conniesiver

What I need to parse out of that data is basically

Date
Time
Drs Name
Patient Name
Appt Time
Appt Date
and then post that to a SQL database. Since it's not really in .csv format I was told that the best way would be to handle this with StreamReader and parse the information out with regex. I've never used StreamReader before so I just want to make sure that I'm approaching this from the right direction. Any help would be appreciated.

Thank you

Doug

yes streamreader is a good approach..

Hi Doug,

StreamReader is one of the good option to parse the csv file. But you need to write extra code to parse each row in the csv file and then post to sql server.

You can also try to use System.Data.OleDb namespace to read and load the csv file content into DataSet/DataTable easily and then update to SQL Server. This approach will help you to avoid writing your own parsing mechanism.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.