using CnasSynchronusClient; using CnasSynchrousModel; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace CNAS_DBSync { public partial class frmSelectInstruItem : Form { private SyncInstrumentItemInfo syncInstrument; public string strSelectedColumn = ""; public frmSelectInstruItem(SyncInstrumentItemInfo syncInstrument) { InitializeComponent(); this.syncInstrument = syncInstrument; } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } private void btnOK_Click(object sender, EventArgs e) { strSelectedColumn = dgvInstruDS.Rows[dgvInstruDS.CurrentCell.RowIndex].Cells["InstruFieldName"].Value.ToString(); this.DialogResult = DialogResult.OK; this.Close(); } private void frmSelectInstruItem_Load(object sender, EventArgs e) { InstrumentData instrumentData = InstrumentDataFact.CreateInstrumentDataSource(syncInstrument.SyncInstrumentDSInfo, new object[] { "", "", "" }); Dictionary dictInstruTables = instrumentData.GetInstrumentData(); string strTableName_Instru = syncInstrument.LstSyncPramas[0].SourceTable; if (dictInstruTables.ContainsKey(strTableName_Instru)) { DataTable dt = dictInstruTables[strTableName_Instru]; if (dt != null) { DataTable dtInstruShow = new DataTable(); dtInstruShow.Columns.Add("InstruFieldName"); dtInstruShow.Columns.Add("InstruDataType"); foreach (DataColumn dc in dt.Columns) { dtInstruShow.Rows.Add(new object[] { dc.ColumnName, dc.DataType }); } dgvInstruDS.DataSource = dtInstruShow; } } } } }