예제 #1
0
 private DataTable ListPayor()
 {
     try
     {
         DataTable distinctValues = new DataTable();
         DataTable dt             = ws.ListPayor();
         DataSet   ds             = new DataSet("ds");
         Tmptable.Columns.Add("Item");
         Tmptable.Columns.Add("Code");
         Tmptable.Columns.Add("Name");
         ds.Tables.Add(Tmptable);
         if (dt.Rows.Count > 0)
         {
             for (int i = 0; i <= dt.Rows.Count - 1; i++)
             {
                 DataRow newRow = Tmptable.NewRow();
                 newRow["Item"] = i + 1;
                 newRow["Code"] = dt.Rows[i]["INST_Code"].ToString();
                 newRow["Name"] = dt.Rows[i]["INST_Desc"].ToString();
                 Tmptable.Rows.Add(newRow);
             }
         }
         DataView view = new DataView(Tmptable);
         distinctValues = view.ToTable(true, "Code", "Name");
         return(distinctValues);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }