Dear Friend's
How to Split the bellow numbers while upload(file format .dat) in asp.net with Oracle.
For Example:My Input is: 20130101730I001,201301012000O001
2013=> for Year
01=> for month
01=> for date
7:30=> for time
I =>for In Time
O => for Out Time
001 => for Employee ID
I want to how to split and save different columns while upload this input.(My input format is Attendance.dat file)
My Table Columns Name is:
Year,Month,Date,Time,In,Out,EmployeeID.
Please help me soon as possible.
Thanks&Regs
Manavalan
Loading
Jignesh TrivediPosted Jan 2, 2013, 10:53 PM
if ur string length is fixed so you can split data using string.Substring function
example
var Inputstr = "20130101730I001,201301012000O001".Split(new char[] { ',' });
foreach (string Input in Inputstr)
{
string Year = Input.Substring(0, 4);
string month = Input.Substring(4, 2);
string dateinstr = Input.Substring(6, 2);
string time = Input.Substring(8, 1) + ":" + Input.Substring(9, 2);
// this bool variable return true when Input time else false
bool IsInTime = Input.Substring(11, 1) == "I" ? true : false;
string EmployeeID = Input.Substring(12);
}
try the above code. revert back if any query.
hope this will help.