Excuse me I can't find my question answer in the site.
I have a project that give and retrieval of some information (text type data) by using a Sqlite database.
But I want add a picture to the one of columns and retrieval that by clicking on the field of that image (docImage in below code).
Can you help me please?
private void LoadData()
{
SetConnection();
sql_con.Open();
sql_cmd = sql_con.CreateCommand();
string CommandText = "select id, docImage, letternum, name, female, personnamber, organname, officename, numberofdoc, numberofbox, ticket, docdate from mains";
DB = new SQLiteDataAdapter(CommandText,sql_con);
DS.Reset();
DB.Fill(DS);
DT= DS.Tables[0];
Grid.DataSource = DT;
sql_con.Close();
}
private void SetConnection()
{
sql_con = new SQLiteConnection("Data Source=DemoT.db;Version=3;New=False;Compress=True;");
}
private void ExecuteQuery(string txtQuery)
{
SetConnection();
sql_con.Open();
sql_cmd = sql_con.CreateCommand();
sql_cmd.CommandText=txtQuery;
sql_cmd.ExecuteNonQuery();
sql_con.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
LoadData();
}
private void Add()
{
string txtSQLQuery = "insert into mains (docImage, letternum, name, female, personnamber, organname, officename, numberofdoc, numberofbox, ticket, docdate ) values ('" + txtDesc11.Text + "','" + txtDesc.Text + "','" + txtDesc2.Text + "','" + txtDesc3.Text + "','" + txtDesc4.Text + "','" + txtDesc5.Text + "','" + txtDesc6.Text + "','" + txtDesc7.Text + "','" + txtDesc8.Text + "','" + txtDesc9.Text + "','" + txtDesc10.Text + "')";
ExecuteQuery(txtSQLQuery);
}
private void btnAdd_Click(object sender, EventArgs e)
{
Add();
LoadData();
btnAdd.Enabled = false;
btnNew.Enabled = true;
btnEdit.Enabled = false;
txtDesc.Text = string.Empty;
txtDesc2.Text = string.Empty;
}