1
Answer

How to pass date paramter for for C# crystal report

Photo of Muhammad Qasim

Muhammad Qasim

10y
524
1

my question mean when user want to see specific record from one date to another date for that I need date parameter in C# windows form application

please help me !

thanks in advance !

Answers (1)

0
Photo of Jignesh Trivedi
NA 61.3k 14.2m 11y

hi,

To do this you have to read whole file first using File.ReadAllText methods

try..

string text = System.IO.File.ReadAllText(@"D:\textfile.txt");
var allText = text.Split(new string[] { "\r\n" }, StringSplitOptions.None);

for (var i = 0; i <= allText.Count(); i++)
{
    string line = allText[i];
    string nextline = allText[i + 1]; // put here validation if it is not exceed the array limit.

    //do your code.
}

hope this will help you.

0
Photo of Vulpes
NA 98.3k 1.5m 11y
If you don't want to read the second line at all if it starts with a ';'  then try this:

     using (StreamReader sr = new StreamReader("atul.txt"))
     {
       int i;
       int c = (int)';';
       string line = null; 

       while ((i = sr.Peek()) > 0)
       {
         if (i == c) break;
         line = sr.ReadLine();
         // code to insert line data into database
       }
     }


0
Photo of Iftikar Hussain
NA 18.9k 275.5k 11y
is you text file content in this format

10029365,20130701,dbt,ep,manfee
;
MGFEE:Management Fee

OR

10029365,20130701,dbt,ep,manfee;MGFEE:Management Fee

Regards,
Iftikar
0
Photo of Mai Hu Na
NA 87 88k 11y
no
0
Photo of Vulpes
NA 98.3k 1.5m 11y
Something like this perhaps?

using (StreamReader sr = new StreamReader("somefile.txt"))
{
    string line;
    while ((line = sr.ReadLine()) != null)
    {
       if (line.Contains(";")) continue;
       // code to insert line data into database
    }
}

If the '; 'will only appear as the first character of a line, you could also use line.StartsWith(";").
0
Photo of Mai Hu Na
NA 87 88k 11y
line1 10029365,20130701,dbt,ep,manfee line2 ;MGFEE:Management Fee i need to check the secondline data and if contain ; charactor skip the line first otherwise insert into datatable.
0
Photo of Iftikar Hussain
NA 18.9k 275.5k 11y
Hi,
        Can you provide your code?

Regards,
Iftikar