WinCE

Zhao_四喜 2017-01-03 11:26:33
wince调ws,不定期出现“无法从传输连接中读取数据”
代码块如下:求大神解答

int num = -1;
if (txt_Vin.Text != "" && txt_location.Text != "")
{
string vin = this.txt_Vin.Text.Trim();
string AL = this.txt_location.Text.Trim();
string Area_Code = AL.Split('-')[0].ToString();
string Location_No = AL.Split('-')[1].ToString();
//WebReference.WebServiceAdd In_Car = new Stock_MGR.WebReference.WebServiceAdd();
try
{

num = Fu.Login.In_Car(vin, W_ID, Area_Code, Location_No);
}
catch(Exception ex)
{
LogerHelper.WriteLog(ex.Message + " print into car error.");
MessageBox.Show("print into car error!");

}
//In_Car.Dispose();
if (num == 1)
{
MessageBox.Show("入库成功!");
//重新绑定列表数据
ViewBind();
txt_Vin.Text = "";
txt_location.Text = "";
txt_Vin.Focus();
}
else if (num == 0)
{
MessageBox.Show("入库失败!");
txt_Vin.Text = "";
txt_location.Text = "";
txt_Vin.Focus();
}
else if (num == 2)
{
MessageBox.Show("此车辆不为待入库车辆!");
txt_Vin.Text = "";
txt_location.Text = "";
txt_Vin.Focus();
}
}
else
{
MessageBox.Show("Vin码或库位都不能为空!");
txt_location.Text = "";
txt_Vin.Text = "";
txt_Vin.Focus();
}
WebService代码如下
//入库
[WebMethod]
public int In_Car(string Vin,string W_ID,string Area_Code,string Location_No)
{
int result = 0;
string sql = "select VIN_Number,Brand_Code,Inventory_ID from TBL_Inventory_records_Detail where VIN_Number='" + Vin + "' and InventoryStauts=0 and Warehouse_ID='" + W_ID + "' and Area_Code='" + Area_Code + "' and Location_No='" + Location_No + "'";
DataTable orname = SQLHelper.ExecuteDataTable(CommandType.Text, sql);
if (orname.Rows.Count != 0)
{
string ID = orname.Rows[0]["Inventory_ID"].ToString();
string Update = "update TBL_Inventory_records_Detail set InventoryStauts=1 where Inventory_ID='" + ID + "'";
int couO = SQLHelper.ExecuteNonQuery(CommandType.Text, Update);
if (couO > 0)
{
result = 1;//入库成功!
}
else
{
result = 0;//入库失败!
}
}
else
{
result = 2;//此车辆信息不为待入库车辆
}
return result;
}
...全文
841 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Zhao_四喜 2017-01-04
  • 打赏
  • 举报
回复
引用 1 楼 91program的回复:
不定时,也就是说大部分时间功能是正常的。 网络连接的稳定性有没有分析过?可以通过 WebService 功能调用的返回值来分析一下可能的原因。 int couO = SQLHelper.ExecuteNonQuery(CommandType.Text, Update); couO 的值在失败时是什么?
失败的时候就报网络错误,但是数据还是执行了的。
91program 2017-01-04
  • 打赏
  • 举报
回复
不定时,也就是说大部分时间功能是正常的。 网络连接的稳定性有没有分析过?可以通过 WebService 功能调用的返回值来分析一下可能的原因。 int couO = SQLHelper.ExecuteNonQuery(CommandType.Text, Update); couO 的值在失败时是什么?
zhujinqiang 2017-01-04
  • 打赏
  • 举报
回复
是通过无线网络吗?

19,498

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧