Вывод таблицы по запросу
Код:
sPath = Path.Combine(Application.StartupPath, "filedata.db");
mydb = new sqliteclass();
sSql = "select fio from card WHERE fio IS NOT NULL";
DataRow[] datarows = mydb.drExecute(sPath, sSql);
if (datarows == null)
{
Text = "Ошибка чтения!";
mydb = null;
return;
}
foreach (DataRow dr in datarows)
{
i++;
dataGridView1.ClearSelection();
dataGridView1.Rows.Add(1);
dataGridView1.Rows[i].Cells[0].Value = dr["fio"].ToString().Trim();
dataGridView1.Rows[i].Cells[1].Value = dr["male"].ToString().Trim();
dataGridView1.Rows[i].Cells[2].Value = dr["birth_date"].ToString().Trim();
dataGridView1.Rows[i].Cells[3].Value = dr["receipt"].ToString().Trim();
dataGridView1.Rows[i].Cells[4].Value = dr["doctor"].ToString().Trim();
}
mydb = new sqliteclass();
sSql = "select fio from card WHERE fio IS NOT NULL";
DataRow[] datarows = mydb.drExecute(sPath, sSql);
if (datarows == null)
{
Text = "Ошибка чтения!";
mydb = null;
return;
}
foreach (DataRow dr in datarows)
{
i++;
dataGridView1.ClearSelection();
dataGridView1.Rows.Add(1);
dataGridView1.Rows[i].Cells[0].Value = dr["fio"].ToString().Trim();
dataGridView1.Rows[i].Cells[1].Value = dr["male"].ToString().Trim();
dataGridView1.Rows[i].Cells[2].Value = dr["birth_date"].ToString().Trim();
dataGridView1.Rows[i].Cells[3].Value = dr["receipt"].ToString().Trim();
dataGridView1.Rows[i].Cells[4].Value = dr["doctor"].ToString().Trim();
}