How to Fill a DataSet by using multiple delimited text files
<p>I work on C# .My input file look likes :</p>

<pre><code>d00 d04 WinMain
d00 d04    lpCmdLine: '/UNREGSERVER'
d00 d04 Run
d00 d04 
           lpCmdLine: '/UNREGSERVER'
d00 d04    nCmdShow: 10
d00 d04 leaving WinMain   

CustomerID  CompanyName ContactName ContactTitle    Address City    Region  PostalCode  Country Phone   Fax
ALFKI   Alfreds Futterkiste Maria Anders    Sales Representative    Obere Str. 57   Berlin  NULL    12209   Germany 030-0074321 030-0076545
ANATR   Ana Trujillo Emparedados y helados  Ana Trujillo    Owner   Avda. de la Constitución 2222   México D.F. NULL    05021   Mexico  (5) 555-4729    (5) 555-3745
ANTON   Antonio Moreno Taquería Antonio Moreno  Owner   Mataderos  2312 México D.F. NULL    05023   Mexico  (5) 555-3932    NULL
AROUT   Around the Horn Thomas Hardy    Sales Representative    120 Hanover Sq. London  NULL    WA1 1DP UK  (171) 555-7788  (171) 555-6750
BERGS   Berglunds snabbköp  Christina Berglund  Order Administrator Berguvsvägen  8 Luleå   NULL    S-958 22    Sweden  0921-12 34 65   0921-12 34 67
BLAUS   Blauer See Delikatessen Hanna Moos  Sales Representative    Forsterstr. 57  Mannheim    NULL    68306   Germany 0621-08460  0621-08924
BLONP   Blondesddsl père et fils    Frédérique Citeaux  Marketing Manager   24, place Kléber    Strasbourg  NULL    67000   France  88.60.15.31 88.60.15.32
BOLID   Bólido Comidas preparadas   Martín Sommer   Owner   C/ Araquil, 67  Madrid  NULL    28023   Spain   (91) 555 22 82  (91) 555 91 99
BONAP   Bon app'    Laurence Lebihan    Owner   12, rue des Bouche
</code></pre>

<hr>

<pre><code>d00 d04 WinMain
d00 d04    lpCmdLine: '/UNREGSERVER'
d00 d04 Run
d00 d04 
           lpCmdLine: '/UNREGSERVER'
d00 d04    nCmdShow: 10
d00 d04 leaving WinMain  

CustomerID  CompanyName ContactName ContactTitle    Address City    Region  PostalCode  Country Phone   Fax
ALFKI   Alfreds Futterkiste Maria Anders    Sales Representative    Obere Str. 57   Berlin  NULL    12209   Germany 030-0074321 030-0076545
ANATR   Ana Trujillo Emparedados y helados  Ana Trujillo    Owner   Avda. de la Constitución 2222   México D.F. NULL    05021   Mexico  (5) 555-4729    (5) 555-3745
ANTON   Antonio Moreno Taquería Antonio Moreno  Owner   Mataderos  2312 México D.F. NULL    05023   Mexico  (5) 555-3932    NULL
AROUT   Around the Horn Thomas Hardy    Sales Representative    120 Hanover Sq. London  NULL    WA1 1DP UK  (171) 555-7788  (171) 555-6750
BERGS   Berglunds snabbköp  Christina Berglund  Order Administrator Berguvsvägen  8 Luleå   NULL    S-958 22    Sweden  0921-12 34 65   0921-12 34 67
BLAUS   Blauer See Delikatessen Hanna Moos  Sales Representative    Forsterstr. 57  Mannheim    NULL    68306   Germany 0621-08460  0621-08924
BLONP   Blondesddsl père et fils    Frédérique Citeaux  Marketing Manager   24, place Kléber    Strasbourg  NULL    67000   France  88.60.15.31 88.60.15.32
BOLID   Bólido Comidas preparadas   Martín Sommer   Owner   C/ Araquil, 67  Madrid  NULL    28023   Spain   (91) 555 22 82  (91) 555 91 99
BONAP   Bon app'    Laurence Lebihan    Owner   12, rue des Bouche
</code></pre>

<p>I want to save this <strong>text files</strong> to *<em>dataset.</em>*How to do that.I write the bellow code to doing this.</p>

<pre><code>DataSet ds = TextToDataSet.Convert(@"C:\readme.txt", "MyNewTable", "\t");


public static DataSet Convert(string File,
 string TableName, string delimiter)
{
    //The DataSet to Return

    DataSet result = new DataSet();

    //Open the file in a stream reader.

    StreamReader s = new StreamReader(File);

    //Split the first line into the columns       

    string[] columns = s.ReadLine().Split(delimiter.ToCharArray());

    //Add the new DataTable to the RecordSet

    result.Tables.Add(TableName);

    //Cycle the colums, adding those that don't exist yet 

    //and sequencing the one that do.

    foreach (string col in columns)
    {
        bool added = false;
        string next = "";
        int i = 0;
        while (!added)
        {
            //Build the column name and remove any unwanted characters.

            string columnname = col + next;
            columnname = columnname.Replace("#", "");
            columnname = columnname.Replace("'", "");
            columnname = columnname.Replace("&amp;", "");

            //See if the column already exists

            if (!result.Tables[TableName].Columns.Contains(columnname))
            {
                //if it doesn't then we add it here and mark it as added

                result.Tables[TableName].Columns.Add(columnname);
                added = true;
            }
            else
            {
                //if it did exist then we increment the sequencer and try again.

                i++;
                next = "_" + i.ToString();
            }
        }
    }

    //Read the rest of the data in the file.        

    string AllData = s.ReadToEnd();

    //Split off each row at the Carriage Return/Line Feed

    //Default line ending in most windows exports.  

    //You may have to edit this to match your particular file.

    //This will work for Excel, Access, etc. default exports.

    string[] rows = AllData.Split("\r\n".ToCharArray());

    //Now add each row to the DataSet        

    foreach (string r in rows)
    {
        //Split the row at the delimiter.

        string[] items = r.Split(delimiter.ToCharArray());

        //Add the item

        result.Tables[TableName].Rows.Add(items);
    }

    //Return the imported data.        

    return result;
}
</code></pre>

<p>If i use the multi delimited than error shows.How to use the multi delimited.If i run the code to to load the text file given in above show the bellow error</p>

<p><strong>Input array is longer than the number of columns in this table.</strong> </p>
