List<string> list = new List<string>();
string yu= @"Data Source=" + "Symbol_Sqlite.sqlite";
dbcon = new SQLiteConnection(yu + "; Version=3");
try
{
dbcon.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
string btn = ((Button)sender).Text;
string sql = "select * from Symbol_Sqlite where symbol like " + "'%" + btn + "%'";
SQLiteDataAdapter sda = new SQLiteDataAdapter(sql, dbcon);
DataTable dt = new DataTable();
sda.Fill(dt);
foreach (DataRow row in dt.Rows)
{
//listBox1.Items.Add(row[0].ToString());
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells[1].Value = row[0].ToString();
dataGridView1.Rows[i].Cells[2].Value = row[1].ToString();
dataGridView1.Rows[i].Cells[3].Value = row[2].ToString();
dataGridView1.Rows[i].Cells[0].Value = false;
i++;
}
dbcon.Close();
i = 0;
check();
连接Sqlite数据库
最新推荐文章于 2023-12-14 09:49:11 发布