I have a code to show combobox value in textboxes and code work fine for me but I convert my project into layer architecture (UI, BLL, DAL, Entity). I don't know c# very well and I'm learning the c#. My problem is that I want to change my code into layer architecture but I don't know how to do that, please help me. Here is the code.
using (SQLiteConnection conn = new SQLiteConnection("Data Source=combolist.db;Version=3;"))
{
string CommandText = "SELECT * FROM combo WHERE [Id]=@id";
using (SQLiteCommand cmd = new SQLiteCommand(CommandText, conn))
{
cmd.Parameters.AddWithValue("@id", comboBox1.SelectedItem.ToString());
conn.Open();
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);
da.Fill(dt);
foreach (DataRow dr in dt.Rows)
{
textBox1.Text = dr["Id"].ToString();
textBox2.Text = dr["FirstName"].ToString();
textBox3.Text = dr["LastName"].ToString();
textBox4.Text = dr["Age"].ToString();
textBox5.Text = dr["Address"].ToString();
}
}
}