示例#1
0
        //加载表数据
        void loadTableData()
        {
            try
            {
                dt = new ReadTable(_systemName.ToUpper().Trim());
                dt.SetCustomFunctionName("ZVI_RFC_READ_TABLE");
                dt.TableName = _tableName;
                //  dt.Fields.Clear();
                // dt.Options.Clear();
                //从界面上加载条件与字段列表
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView1.Rows[i].Cells["FieldName"].Value != null)
                    {
                        if (dataGridView1.Rows[i].Cells["Select"] != null & (bool)dataGridView1.Rows[i].Cells["Select"].Value == true)
                        {
                            string s = dataGridView1.Rows[i].Cells["FieldName"].Value.ToString();
                            if (!string.IsNullOrEmpty(s))
                            {
                                dt.AddField(s);
                            }
                        }
                    }
                }

                for (int i = 0; i < dataGridView2.Rows.Count; i++)
                {
                    if (dataGridView2[0, i].Value != null)
                    {
                        string s = dataGridView2[0, i].Value.ToString();
                        if (!string.IsNullOrEmpty(s))
                        {
                            dt.AddCriteria(s);
                        }
                    }
                }

                dt.RowCount = Convert.ToInt32(rowNum.Text);
                dt.Run();
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
示例#2
0
 //加载表数据
 void loadTableData()
 {
     try
     {
         SendMessage("开始");
         m_dt = new ReadTable(m_systemName);
         m_dt.EventMessage += dt_eventMessage;
         // dt.SetCustomFunctionName("Z_XTRACT_IS_TABLE");
         m_dt.SetCustomFunctionName("ZVI_RFC_READ_TABLE");
         m_dt.TableName = m_tableName;
         m_dt.Delimiter = m_delimiter;
         //  dt.Fields.Clear();
         // dt.Options.Clear();
         //从界面上加载条件与字段列表
         SendMessage("加载字段列表");
         for (int i = 0; i < dataGridView1.Rows.Count; i++)
         {
             if (dataGridView1.Rows[i].Cells["FieldName"].Value != null)
             {
                 if (dataGridView1.Rows[i].Cells[0].Value != null)
                 {
                     if ((bool)dataGridView1.Rows[i].Cells[0].Value == true)
                     {
                         string s = dataGridView1.Rows[i].Cells["FieldName"].Value.ToString();
                         if (!string.IsNullOrEmpty(s))
                         {
                             m_dt.AddField(s);
                         }
                     }
                 }
             }
         }
         SendMessage("加载条件");
         for (int i = 0; i < dataGridView2.Rows.Count; i++)
         {
             if (dataGridView2[0, i].Value != null)
             {
                 string s = dataGridView2[0, i].Value.ToString();
                 if (!string.IsNullOrEmpty(s))
                 {
                     m_dt.AddCriteria(s);
                 }
             }
         }
         m_dt.RowCount = Convert.ToInt32(rowNum.Text);
         SendMessage("开始异步调用");
         try
         {
             Thread thread = new Thread(new ThreadStart(excute));
             thread.Start();
         }
         catch (Exception e)
         {
             MessageBox.Show(e.Message);
         }
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message);
     }
 }