现在处理一个项目,调用了外部delphi写的dllpublic partial class ProductionManage_ProInManage : System.Web.UI.Page
{ cKmtMeter.IComMeter aa = new ComMeterClass();
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "getRow")
{
Response.Write("当前行号为:" + e.CommandArgument);
int index = Convert.ToInt32(e.CommandArgument);
int number = index - 1; //初始化
aa.Init("A"); aa.Open();
aa.Setup(); this.TextBox9.Text = "初始,打开,设置";
bool flag1 = aa.GetStopStat(); //通讯是否稳定
if (flag1 == true)
{ this.TextBox10.Text = "通讯稳定";
}
else
{ this.TextBox10.Text = "通讯不稳定";
}
bool flag2 = aa.GetConnStat(); //是否通讯
if (flag2 == true)
{ this.TextBox11.Text = "通讯";
}
else
{ this.TextBox11.Text = "不通讯";
}
//初始化结束 int a1 = 0;
string a2 = "";
aa.GetMeterData(ref a1, ref a2); this.TextBox13.Text = a1.ToString();
this.TextBox14.Text = a2; string s3=aa.GetScaleName(); ((TextBox)GridView1.Rows[number].FindControl("beizhu")).Text = a2; //关闭
aa.Close();//关闭
aa = null;
//关闭结束
} }
}这样没有任何错误,程序完全正常如果我新加了两个按钮,一个初始化按钮,一个关闭按钮
然后把初始化的那段代码,和关闭的代码摘出来放在各自的按钮先,会提示 服务器出现意外情况。 (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT)) 错误。各位碰到过这种情况的解释解释,多谢!
{ cKmtMeter.IComMeter aa = new ComMeterClass();
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "getRow")
{
Response.Write("当前行号为:" + e.CommandArgument);
int index = Convert.ToInt32(e.CommandArgument);
int number = index - 1; //初始化
aa.Init("A"); aa.Open();
aa.Setup(); this.TextBox9.Text = "初始,打开,设置";
bool flag1 = aa.GetStopStat(); //通讯是否稳定
if (flag1 == true)
{ this.TextBox10.Text = "通讯稳定";
}
else
{ this.TextBox10.Text = "通讯不稳定";
}
bool flag2 = aa.GetConnStat(); //是否通讯
if (flag2 == true)
{ this.TextBox11.Text = "通讯";
}
else
{ this.TextBox11.Text = "不通讯";
}
//初始化结束 int a1 = 0;
string a2 = "";
aa.GetMeterData(ref a1, ref a2); this.TextBox13.Text = a1.ToString();
this.TextBox14.Text = a2; string s3=aa.GetScaleName(); ((TextBox)GridView1.Rows[number].FindControl("beizhu")).Text = a2; //关闭
aa.Close();//关闭
aa = null;
//关闭结束
} }
}这样没有任何错误,程序完全正常如果我新加了两个按钮,一个初始化按钮,一个关闭按钮
然后把初始化的那段代码,和关闭的代码摘出来放在各自的按钮先,会提示 服务器出现意外情况。 (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT)) 错误。各位碰到过这种情况的解释解释,多谢!
你得调试这个COM组件。