“乱序获得分组";在ASP.Net C#中执行LOAD命令时出错,但在MYSQL中工作正常. [英] "Got Packets out of order" error while execting LOAD command From ASP.Net C# while it works fine in MYSQL..

查看:62
本文介绍了“乱序获得分组";在ASP.Net C#中执行LOAD命令时出错,但在MYSQL中工作正常.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在MySql中使用该查询时,我执行以下 MYSQL的 LOAD查询,该查询工作正常,但是当我尝试通过.Net执行该查询时,我错误:数据包出现乱序错误.

我的代码:-

 尝试
{
    MySqlCommand cmdMySQL = conn.CreateCommand();
    如果(conn.State == ConnectionState.Open)
        conn.Close();
    conn.ConnectionString = bs.constring;
    conn.Open();
    tran = conn.BeginTransaction();
    cmdMySQL.CommandText =  @" 结尾的行;
    cmdMySQL.ExecuteNonQuery();
    tran.Commit();
}
捕获(例外)
{
    tran.Rollback();
    Label1.Text = "  + ex .ToString();
}
最终
{
    conn.Close();
    conn.Dispose();
} 



MySql Load Command是正确的,我已经检查了很多次(并且我的C驱动器中有该文件&该cmd中的所有内容都可以..)
任何人都可以告诉我什么可以帮助我...
或至少这个错误是什么意思...
我已经在asp.net&中使用了此命令它工作得很好...

克里斯汀·格劳斯.
感谢您的答复.
实际上,我有一个uplaodFile控件,您可以通过该控件来更新包含所需数据的CSV文件,然后将此文件保存在我的应用程序中,然后将此文件复制到使用我的应用程序的用户计算机的C驱动器中. 这一切都很好...
因为没有问题.
简而言之,您可以将命令查看为:

 cmdMySQL.CommandText =  @" ; 


终止的行 其中C:\ WebSite1 \ UploadData \ state1.txt路径存在& state1.txt有我的数据.
相同的命令在MYSQL中工作正常,但在ASP.Net中却行不通(错误:数据包出现乱序错误)

解决方案

文件如何进入根驱动器您的服务器?我希望当用户将其上传到服务器时,它需要存储在应用程序的根目录下.我删除了重复的问题,也删除了虚假的答案",并根据需要对帖子进行了编辑,以包括您的进一步评论.

好的,因此您正在使用服务器上的文件,并且已正确映射到Web应用程序中的文件路径.我只能假设该错误与在Web应用程序内部运行有关.也许如果您编辑帖子以向我们提供ACTUAL错误消息和堆栈跟踪信息?

您可能还希望查看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)

解决方案

How does the file get onto the root drive of your server ? I would expect when the user uploads it to the server, it would need to be stored under the application root.


Hi again. I deleted your duplicate question and also your fake ''answer'' and edited your post to include your further comments, as it should be.

OK, so you''re using the file on the server, and you''re mapping to the file path correctly inside your web application. I can only assume that the error has to do with running inside a web app. Perhaps if you edit your post to give us the ACTUAL error message and stack trace ?

You might also want to look
here[^].


Hi,Christian Graus.
Im new to code project..
And i dnt know how to re-question to the person who have posted me answer to my question thats why i submit it as answer.
Can u tell me how to do this.

And thanks 4 that reference..
im checking it,to get my answer.


这篇关于“乱序获得分组";在ASP.Net C#中执行LOAD命令时出错,但在MYSQL中工作正常.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆