Click here to Skip to main content
15,887,335 members
Home / Discussions / C#
   

C#

 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 23:41
yueru29-Apr-09 23:41 
GeneralRe: Split text file by Fixed Length Pin
musefan29-Apr-09 23:56
musefan29-Apr-09 23:56 
GeneralRe: Split text file by Fixed Length [modified] Pin
yueru30-Apr-09 0:09
yueru30-Apr-09 0:09 
GeneralRe: Split text file by Fixed Length Pin
musefan30-Apr-09 0:36
musefan30-Apr-09 0:36 
GeneralRe: Split text file by Fixed Length Pin
OriginalGriff30-Apr-09 1:33
mveOriginalGriff30-Apr-09 1:33 
AnswerRe: Split text file by Fixed Length Pin
N a v a n e e t h29-Apr-09 21:58
N a v a n e e t h29-Apr-09 21:58 
QuestionRe: Split text file by Fixed Length Pin
yueru29-Apr-09 22:06
yueru29-Apr-09 22:06 
AnswerRe: Split text file by Fixed Length Pin
yueru5-May-09 21:23
yueru5-May-09 21:23 
Forget about Fixed length it's not my point
NOw I 've got the code
String inputfilename = "";
 private void Add(){

  StreamReader reader = new StreamReader(inputfilename);
            //MessageBox.Show(inputfilename);

            string line = reader.ReadLine();

            while (line != null)
            {
                string Date = line.Substring(12, 8);
                if (line.Substring(11, 1) == "=")
                {
                    string Time = line.Substring(21, 5);
                    string Linein = line.Substring(27, 10);
                    string Lineout = line.Substring(38, 1);
                    

                    if ((string.Compare(Lineout, "0") > 0 || string.Compare(Lineout, "0") == 0) && (string.Compare(Lineout, "9") < 0 || string.Compare(Lineout, "9") == 0))
                    {
                        //int g = line.Length;
                        //string Number = line.Substring(40, g - 40);
                        string Number = line.Substring(40, 20);
                        string Status = line.Substring(61, 3);
                         string Duration = line.Substring(65, 9);
                          string Cost = line.Substring(75, 3);
                         string Detail = line.Substring(79, 2);
                         string Network = line.Substring(82, 8);
                       // trim whitespace from both ends of the elements

                        string txtSQLQuery = "insert into par values('" + Date + "','" + Time + "','" + Linein + "','" + Lineout + "','" + Number + "','" + Status + "','" + Duration + "','" + Cost + "','" + Detail + "','" + Network + "')";
                        ExecuteQuery(txtSQLQuery);

                        //MessageBox.Show(line);


                        textBox6.Text = textBox6.Text + "\r\n" + Date + " " + Time + " " + Linein + " " + Lineout + " " + Number + " ";
                    }
                    else
                    {
                        textBox5.Text = line + "\r\n" + textBox5.Text;

                    }
                }
                else
                {
                    textBox5.Text = line + "\r\n" + textBox5.Text;
                }
                line = reader.ReadLine();
            }

            MessageBox.Show("End while loop");
        }

thx for all comment +_! Smile | :)
AnswerRe: Split text file by Fixed Length Pin
Mycroft Holmes29-Apr-09 21:59
professionalMycroft Holmes29-Apr-09 21:59 
AnswerRe: Split text file by Fixed Length Pin
Vasudevan Deepak Kumar29-Apr-09 22:33
Vasudevan Deepak Kumar29-Apr-09 22:33 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 23:24
yueru29-Apr-09 23:24 
AnswerRe: Split text file by Fixed Length Pin
Mbah Dhaim30-Apr-09 3:01
Mbah Dhaim30-Apr-09 3:01 
QuestionQuestion on Web serivce... Pin
Siva Koyi29-Apr-09 21:23
Siva Koyi29-Apr-09 21:23 
AnswerRe: Question on Web serivce... Pin
N a v a n e e t h29-Apr-09 21:56
N a v a n e e t h29-Apr-09 21:56 
GeneralRe: Question on Web serivce... Pin
Siva Koyi29-Apr-09 22:11
Siva Koyi29-Apr-09 22:11 
GeneralRe: Question on Web serivce... Pin
N a v a n e e t h29-Apr-09 23:07
N a v a n e e t h29-Apr-09 23:07 
GeneralRe: Question on Web serivce... Pin
Jabbar_espania30-Apr-09 1:33
Jabbar_espania30-Apr-09 1:33 
AnswerRe: Question on Web serivce... Pin
saanj29-Apr-09 23:47
saanj29-Apr-09 23:47 
Questionthread cpu usage Pin
shefa' isied29-Apr-09 21:07
shefa' isied29-Apr-09 21:07 
AnswerRe: thread cpu usage Pin
Jack Li29-Apr-09 21:21
Jack Li29-Apr-09 21:21 
AnswerRe: thread cpu usage Pin
N a v a n e e t h29-Apr-09 21:52
N a v a n e e t h29-Apr-09 21:52 
QuestionICollectionView Pin
Paw Jershauge29-Apr-09 20:29
Paw Jershauge29-Apr-09 20:29 
AnswerRe: ICollectionView Pin
Jack Li29-Apr-09 21:17
Jack Li29-Apr-09 21:17 
GeneralRe: ICollectionView Pin
Paw Jershauge29-Apr-09 21:41
Paw Jershauge29-Apr-09 21:41 
AnswerRe: ICollectionView Pin
Spunky Coder29-Apr-09 21:58
Spunky Coder29-Apr-09 21:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.