读书人

在位置 0 处没有任何行。 lt;待gt

发布时间: 2012-02-25 10:01:49 作者: rapoo

在位置 0 处没有任何行。 <在线等待>
错误信息:
“/ERP0905”应用程序中的服务器错误。
--------------------------------------------

在位置 0 处没有任何行。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.Exception: 在位置 0 处没有任何行。

源错误:


行 78: catch (Exception EX)
行 79: {
行 80: throw new Exception(EX.Message);
行 81:
行 82: }


源文件: f:\ERP0905\DistributionDepartment\ContactOperational.aspx.cs 行: 80

堆栈跟踪:


[Exception: 在位置 0 处没有任何行。]
DistributionDepartment_ContactOperational.bind() in f:\ERP0905\DistributionDepartment\ContactOperational.aspx.cs:80
DistributionDepartment_ContactOperational.Page_Load(Object sender, EventArgs e) in f:\ERP0905\DistributionDepartment\ContactOperational.aspx.cs:19
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3745

---------------------------------------
程序:
public DataRow bind()
{
if (mySqlConnection.State == ConnectionState.Open)
mySqlConnection.Close();
mySqlConnection.Open();
SqlDataAdapter sa = new SqlDataAdapter( "select * from ContactOperational where Serial = ' " + Request.QueryString[ "Id "] + " ' ", mySqlConnection);
DataSet dr = new DataSet();
sa.Fill(dr, "ContactOperational ");

sa.Fill(dr);
try
{
return dr.Tables[ "ContactOperational "].Rows[0];

}
catch (Exception EX)
{


throw new Exception(EX.Message);

}
finally
{
mySqlConnection.Close();
}

}


[解决办法]
if (dr.Tables[ "ContactOperational "].Rows.Count> 0)
{
return dr.Tables[ "ContactOperational "].Rows[0];
}
[解决办法]
try
{
if(dr.Tables[ "ContactOperational "].Rows.Count > 0)
return dr.Tables[ "ContactOperational "].Rows[0];
else return null;

}

读书人网 >C#

热点推荐