I'm creating a datatable for the first time and I'm having some difficulties. I have the following code:
What I'm trying to do is as follows:
I have the following data that basically I only need a few bits of information from:
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","Mo nday, July 12, 2010","Time","P atient Name","Patient ID","Appt. Type","Ref. Source/ Physician","Pho ne","Type","D OB ","Brothers LCSW, Gary","Austin Pain Associates","7/12/2010 12:00:00AM","Ti me","Patient Name","Patient ID","Appt. Type","Phone"," Type","DOB "," 7:30 AM","Muniz Jr, Reynaldo A","27380"," SO - Ind Psych Therapy - 45","","(512) xxx-7023","Mobile", "03/25/1965"," 7:30 AM","Muniz Jr, Reynaldo A","27380"," SO - Ind Psych Therapy - 45","(512) xxx-7023","Mobile", "03/25/1965","Truong, Kimphuong P","(512) xxx-5472","Financia l Class:","Medica re","Status:"," Auth Complete","","" ,"Age:","45 yrs","Notes:"," counseling - conniesiver
The only things I need from this are:
Patients Name
Drs Name
Patients Phone Number
Appt Time
Appt Date
and the rest of the information I can discard. A customer uploads this as a .csv file (even though it really isn't as you can see) and I'd like to parse the needed information and post that to my SQL database and discard the rest. I think I can do this with a dataset but I've never built that before. The fields from the customer will always be the same and the fields I will need will always be the same.
Also, the date time has to be in the format of yyyy/mm/dd:hhmm and the phone number always has to have 512 as a prefix.
This is my first time creating a datatable and I've read how to create them but I'm having some problems. Any help would be appreciated.
Thank you,
Doug
Code:
Protected Function Dataparse(ByVal Save As String) As String
Dim DataSet ds = new DataSet();
Dim Datatable dt = new Datatable();
System.Data.Odbc.OdbcConnection conn;
System.Data.Odbc.OdbcDataAdapter da;
string connString;
string importFolder = @"\\MSBWEB3\wwwroot\Webfile1\Reminders\Doug_Ancil\";
string fileName = "doug.csv";
connString = @"Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + importFolder + ";";
conn = new System.Data.Odbc.OdbcConnection(connString);
da = new System.Data.Odbc.OdbcDataAdapter("select * from [" + fileName + "]", conn);
da.Fill(ds,"Sample");
End Function
I have the following data that basically I only need a few bits of information from:
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","Mo nday, July 12, 2010","Time","P atient Name","Patient ID","Appt. Type","Ref. Source/ Physician","Pho ne","Type","D OB ","Brothers LCSW, Gary","Austin Pain Associates","7/12/2010 12:00:00AM","Ti me","Patient Name","Patient ID","Appt. Type","Phone"," Type","DOB "," 7:30 AM","Muniz Jr, Reynaldo A","27380"," SO - Ind Psych Therapy - 45","","(512) xxx-7023","Mobile", "03/25/1965"," 7:30 AM","Muniz Jr, Reynaldo A","27380"," SO - Ind Psych Therapy - 45","(512) xxx-7023","Mobile", "03/25/1965","Truong, Kimphuong P","(512) xxx-5472","Financia l Class:","Medica re","Status:"," Auth Complete","","" ,"Age:","45 yrs","Notes:"," counseling - conniesiver
The only things I need from this are:
Patients Name
Drs Name
Patients Phone Number
Appt Time
Appt Date
and the rest of the information I can discard. A customer uploads this as a .csv file (even though it really isn't as you can see) and I'd like to parse the needed information and post that to my SQL database and discard the rest. I think I can do this with a dataset but I've never built that before. The fields from the customer will always be the same and the fields I will need will always be the same.
Also, the date time has to be in the format of yyyy/mm/dd:hhmm and the phone number always has to have 512 as a prefix.
This is my first time creating a datatable and I've read how to create them but I'm having some problems. Any help would be appreciated.
Thank you,
Doug
Comment