private bool getdata(dataset dsmydataset)
{
bool isuf;
if(isuf)
{
   ......
   try
{
.....
}
    catch(Exception e)
{         throw(e);
}
問題:此時isuf=什麼false/true?
}
return isuf;
}請邦我回答問題時付載一個例子可以嗎?謝謝了!

解决方案 »

  1.   

    private bool getdata(dataset dsmydataset)
    {
       try
    {
    .....
    return true;
    }
        catch(Exception e)
    {
     
           return false;
    }
    }
      

  2.   

    private bool getdata(dataset dsmydataset) 
    {
        
    }
    楼主这个方法用什么用?你要明确。然后返回值用:return isuf;
      

  3.   

    bool isuf;//这句,你没有声明初始值,默认是false;
      

  4.   

    private bool getdata(dataset dsmydataset)
    {
        bool isuf;
        string  str;
        if(str == "abcd")
        {
           return isuf=true;
        }
        else
       {
           return isuf=false;
       }
    }
      

  5.   

    謝謝你們的例子:是做更新的。。
    能寫一個好一點例子嗎?
    要不我在哪一個例子,你們工作開發中不經常用這個BOOL值來控制一些工能嗎?
      

  6.   

    如:
    請你幫我解說其中的 道理所在?謝謝!這對我來說很重要哦!因為我們經常要用。。快點可以嗎、?判斷flag值的
    public bool DealDataSetRowsOfFlag(DataSet DataRows,ActionTable DataBase)
    {
    bool isSuf = true;
    foreach (DataTable DT in DataRows.Tables)
    {
    DataColumn[] DC = DT.PrimaryKey;
    if (DT.Rows.Count > 0)
    {
    for (int i = 0;i < DT.Rows.Count ; i++)
    {
    if (DT.Rows[i].RowState == System.Data.DataRowState.Modified)
    {
    if (DC.Length > 0)
    {
    decimal _Flag;
    FieldProperty[] myFP = new FieldProperty[DC.Length];
    CDenotationValue[] myCD = new CDenotationValue[DC.Length];
    string[] txtValue = new string[1];
    int[] txtIndex = {-1};
    int _index = 0; Query_Windows myQuery = new Query_Windows(); foreach (DataColumn CDC in DC)
    {
    myFP[_index] = new FieldProperty(CDC.ColumnName,"V",DT.Rows[i][CDC.ColumnName]);
    myCD[_index] = new CDenotationValue("=","AND");
    _index++;
    }
    myQuery.GetInfo(DT.TableName,myFP,myCD,txtValue,txtIndex,DataBase);
    _Flag = (txtValue[0] == null || txtValue[0].Trim() == string.Empty)?0:decimal.Parse(txtValue[0]);
    if (_Flag == (decimal)DT.Rows[i]["FLAG"])
    {
    DT.Rows[i]["FLAG"] = (decimal)DT.Rows[i]["FLAG"] + 1;
    isSuf = true;
    }
    else
    isSuf = false;
    }
    else
    {
    DT.Rows[i]["FLAG"] = (decimal)DT.Rows[i]["FLAG"] + 1;
    isSuf = true;
    }
    }
    }
    }
    }
    return isSuf;
    }
    }
      

  7.   

    就是要你們幫我說說其中的bool值部分
    象他們那樣一會true, 一 會false 其中的道理在哪。。或者說你知道可以給我一個好的例子呀!
    我不清楚其中的邏輯所在!
      

  8.   


    如你知道我要問的是什麼!代碼不用管理,你就是幫我講解為什麼 bool值在某位置是那樣的值!
    然後這樣以會把程序控制的怎樣!!!
    給我一個例吧!幫幫我。。
    要不看這個吧!
    private bool OpinionSalesDate()
    {
    if (myFormActionType == ActionType.Create || myFormActionType == ActionType.Edit)
    {
    dgCOPTH.CurrentCellChanged -=new EventHandler(dgCOPTH_CurrentCellChanged);
    }
    string Errmsg = "";
    bool isOK = true;
    string[] txtValue = new string[1];
    int[] intValue = {38};
    string strDate = DateTime.Today.ToString("yyyyMMdd");
    FieldProperty[] myFP = null;
    CDenotationValue[] myCD = new CDenotationValue[]{
    new CDenotationValue("=","AND"),
    new CDenotationValue("=","AND"),
    new CDenotationValue("=","AND")
    };
    System.Windows.Forms.BindingManagerBase myBM = BindingContext[dgCOPTH.DataSource,dgCOPTH.DataMember];
    myBM.EndCurrentEdit();
    int index = myBM.Position;
    if (myBM.Count > 0)
    {
    Query_Windows myQuery = new Query_Windows();
    for (int i = 0;i < myBM.Count ;i++)
    {
    myBM.Position = i;
    DataRowView myDRV = (DataRowView)myBM.Current;
    if (myDRV.Row["TH014"].ToString().Trim()+myDRV.Row["TH015"].ToString().Trim()+myDRV.Row["TH016"].ToString().Trim() != "")
    {
    txtValue[0] = "";
    myFP = new FieldProperty[]{
      new FieldProperty("TD001","V",myDRV.Row["TH014"].ToString().Trim()),
      new FieldProperty("TD002","V",myDRV.Row["TH015"].ToString().Trim()),
      new FieldProperty("TD003","V",myDRV.Row["TH016"].ToString().Trim()),
    };
    myQuery.GetInfo("COPTD",myFP,myCD,txtValue,intValue,ActionTable.Leader);
    if (txtValue[0].CompareTo(strDate)<=0)
    Errmsg += string.Format("\n\t{0}","訂單:"+myDRV.Row["TH014"].ToString().Trim()+" "+myDRV.Row["TH015"].ToString().Trim()+" "+myDRV.Row["TH016"].ToString().Trim()+" "+"已超過[終止出貨日期]!");
    }
    }
    }
    myBM.Position = index;
    if (Errmsg != string.Empty)
    {
    Errmsg += string.Format("\n\t{0}","是否確認執行?");
    if (MessageBox.Show(this,Errmsg,"銷貨單建立作業",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No)
    isOK = false;
    else
    isOK = true;
    }
    if (myFormActionType == ActionType.Create || myFormActionType == ActionType.Edit)
    {
    dgCOPTH.CurrentCellChanged +=new EventHandler(dgCOPTH_CurrentCellChanged);
    }
    return isOK;
    }
      

  9.   

    条件为真就返回True;否则就返回False.就是这样啊.........