tags:

views:

20

answers:

0

I currently use the code below but its not uncommon for it to throw an "tried to read past the stream" error once the mysql table has reached over 20 thousand entries.

MySqlConnection connection = new MySqlConnection(MyConString);
            MySqlCommand command = connection.CreateCommand();
            connection.Open();
            command.CommandText = "SELECT * FROM mytable";
            MySqlDataReader result = command.ExecuteReader();
            string thisrow = "";
                if (result != null)
                    while (result.Read())
                    {

                        for (int i = 0; i < result.FieldCount; i++)
                            thisrow += result.GetValue(i).ToString() + ",";
                        pass = Regex.Replace(thisrow, @"\W*", "");
                        if (!hshTable.ContainsKey(pass)) hshTable.Add(pass, pass);
                    }
            connection.Close();

is there a mysql command like LOAD DATA LOCAL INFILE 'C:/mysqltable.txt' INTO TABLE mytable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'";

but instead of loading a file to the database it downloads the table instead? or is there a better way of doing this without using extra applications and/or software?