我正在尝试连接安装在LAN中不同计算机上的多个数据库。我从datagridview的特定列获取源和用户的值。但是它不在每台计算机上应用查询。
DataTable dt = new DataTable();
dt = (DataTable)dataGridView1.DataSource;
for (int i = 0; i < dt.Rows.Count; i++)
{
int[] array = new int[i];
DataSet ds = new DataSet();
string source = dt.Rows[i][3].ToString();
string user = dt.Rows[i][1].ToString();
int password = Convert.ToInt32(user) + 111;
OracleConnection conn = new OracleConnection("Data Source = " + source + ": 1521/orcl; User id = " + user + "; Password=" + password + ";");
conn.Open();
OracleCommand cmd = new OracleCommand("select ID_STR_RT,ID_WS from tr_rtl where MO_SLS_TOT like '%1%' and DC_DY_BSN='2018-03-01'", conn);
cmd.ExecuteNonQuery();
OracleDataAdapter oda = new OracleDataAdapter(cmd);
DataTable dts = new DataTable();
oda.Fill(dts);
dataGridView1.DataSource = dts;
conn.Close();