Home > Net >  Armed with abnormal program error, and the great god, the return value is beyond the scope of expect
Armed with abnormal program error, and the great god, the return value is beyond the scope of expect

Time:09-24


abnormal screenshot, the probability of error probability is about 5%, after the data recovery can emersion not debugging;

error values did not fall within the scope of the expect
The value does not fall within the expected range.
code is as follows:
 private void button1_Click (object sender, EventArgs e) 
{
Try
{if (MessageBox. Show (" to confirm the current task!" , "tip", 4, 32, 0).=7)
{string text=this. LabHWID. Get_Text ();//pallet id
String text2=this. Labspid. Get_Text ();//commodity id
String text3=this. Labphid. Get_Text ();//batch id
If (this. G_dsPickData. Get_Tables () get_Item (0). Get_Rows () get_Count () & gt; 0)
{
String text4=this. G_dsPickData. Get_Tables () get_Item (0). Get_Rows () get_Item (0). Get_Item (" SF_ZY "). The ToString ();//whether the Chinese traditional medicine the default 0
}
String text5=this. LbSum. Get_Text ();//total number of picking
Cursor. Set_Current (your Cursors. Get_WaitCursor ());
Service Service=new Service ();
String strp_in=string Concat (new string []//picking confirmation process to be obtained four parameters of picking order goods batch turnover box
{
"& lt; CKJHQR> <" , enclosing m_strDJBH_RW, "& gt; <" , the text, "& gt; <" , text3, "& gt; "
});
The DataSet DataSet=new DataSet ();//database
The dataSet=service. WebService. P_PDA_CUROR (strp_in);//database by value
Cursor. Set_Current (your Cursors. Get_Default ());//return value 0 text6 database picking picking complete unfinished 1-1 exception error
String text6=dataSet. Get_Tables (). The get_Item (0). Get_Rows () get_Item (0). Get_Item (0). The ToString ();
If (text6=="0")///picking is not the last one unfinished goods picking confirmation
{
If (this. G_dsPickData. Get_Tables () get_Item (0). Get_Rows () get_Count () & gt; 0)
{
For (int I=this. G_dsPickData. Get_Tables () get_Item (0). Get_Rows () get_Count () - 1; I & gt;=0; I -)
{
If (this. G_dsPickData. Get_Tables () get_Item (0). Get_Rows () get_Item (I). The get_Item (" hwid "). The ToString ()==text & amp; & Enclosing g_dsPickData. Get_Tables (). The get_Item (0). Get_Rows () get_Item (I). The get_Item (" phid "). The ToString ()==text3)
{
Enclosing g_dsPickData. Get_Tables (). The get_Item (0). Get_Rows () RemoveAt (I);
}
}
This. The Clear ();//clear display
Enclosing mShowData (enclosing g_dsPickData. Get_Tables () get_Item (0). Get_Rows () get_Item (0). Get_Item (" HWID "). The ToString ());//pallet id
Enclosing m_strNo=this. G_dsPickData. Get_Tables () get_Item (0). Get_Rows () get_Count (). The ToString ();
Enclosing lbSumNo. Set_Text (enclosing m_strNo + "/" + enclosing m_strSum);//total number of picking
}
}
Else if (text6=="1")//picking completed
{MessageBox. Show (" confirmation to complete all ");
Enclosing blClose=false; Base. The Close ();
String text7=dataSet. Get_Tables (). The get_Item (0). Get_Rows () get_Item (0). Get_Item (" INFO "). The ToString ();
If (text7=="1")//info return 1 pop-up review stage prompt box
{FrmShowZCHW FrmShowZCHW=new FrmShowZCHW (enclosing m_strDJBH_RW);//the pop-up nuclear station box
FrmShowZCHW. ShowDialog (); }}
Else if (text6=="1")//system error, returns database ora error description
{
String text8=dataSet. Get_Tables (). The get_Item (0). Get_Rows () get_Item (0). Get_Item (" INFO "). The ToString ();
MessageBox. Show (text8);//display error message
}
The else
{
MessageBox. Show (" data update failed: "+ text6," database error!" );//database error!
}
}
}
Catch Exception (ex)//thrown Exception database error 1: the return value is not within the scope of 2: position 0 3: no data
{
Cursor. Set_Current (your Cursors. Get_Default ());
MessageBox. Show (ex. Get_Message (), ToString (), "database error!" );//the return value is beyond the scope of anticipated
}
}

CodePudding user response:

Use file record first positioning to the error log, occasional mistake toughest,
Write a log, a few lines went wrong after a look at the end of the logging location, position error is below,

CodePudding user response:

Abnormal information record is too little,

You need to record this three,
Ex. The Message
Ex. InnerException. Message
Ex. The StackTrace

We can analysis

CodePudding user response:

You write log to find the law of the error, such as when performing ten times, every tenth certain error, program is dead will regularly, you can put the wrong that you quoted a few times the output parameters of debugged, performed one hundred times normal, behind may perform again have a problem, it may is a problem of parameter

CodePudding user response:

Thank you for your reply, and provide the ideas and methods to solve the problem,
  •  Tags:  
  • C#
  • Related