I execute the following
LOAD query of MYSQL, which
works fine, when I use this query in MySql, but when I try to execute it through .Net it gives me
error: Got Packets out of order error.
My Code:-
try
{
MySqlCommand cmdMySQL = conn.CreateCommand();
if (conn.State == ConnectionState.Open)
conn.Close();
conn.ConnectionString = bs.constring;
conn.Open();
tran = conn.BeginTransaction();
cmdMySQL.CommandText = @"LOAD DATA LOCAL INFILE 'C:\state1.txt' INTO TABLE state1 FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n'";
cmdMySQL.ExecuteNonQuery();
tran.Commit();
}
catch (Exception ex)
{
tran.Rollback();
Label1.Text = "Data is not imported!! <br/>Error:" + ex.ToString();
}
finally
{
conn.Close();
conn.Dispose();
}
MySql Load Command is Correct, I have checked many times (and my C drive have that file & everything in that cmd is all right..)
Can any one tell me what can help me...
Or at least what this error means...
This command I have used with asp.net & it had worked fine...
Hi, Christian Graus.
Thanks for your reply.
Actually, I have a uplaodFile control through which you can uplaod CSV file containing required data, I save this file in my application and then copy this file to C Drive of user's computer who is using my application.
This all works fine...
In that there is no issue.
In short you can view command as:
cmdMySQL.CommandText = @"LOAD DATA LOCAL INFILE 'C:\WebSite1\UploadData\state1.txt' INTO TABLE state1 FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n'";
Where C:\WebSite1\UploadData\state1.txt path exists & state1.txt has my data.
This same command works fine in MYSQL, but not in ASP.Net (error: Got Packets out of order error)