我无法获取所有数据

时间:2019-05-27 07:01:31

标签: c#

我已读取行,并使用它运行sql查询。循环是正确的,但是仅处理一行。请支持我。

for (int i = 0; i < Excel_read.Rows.Count - 1; i++)
            {
                string readRow = Excel_read.Rows[i].Cells[0].Value.ToString();
                //MessageBox.Show(xaxa);

                //MessageBox.Show(readRow);

                MySqlDataAdapter adp = new MySqlDataAdapter("SELECT `Calling number`,`Call time`  FROM test.tbltest WHERE `Calling number` = " + readRow + " GROUP BY `Calling number`", connection);

                System.Data.DataTable test = new System.Data.DataTable();
                adp.Fill(test);
                Excel_read.DataSource = test;
                adp.Dispose();
            }
            connection.Close();

0 个答案:

没有答案