C#
-
Hi, I had a database in access I want to connect through connection string where shall I write the connection string so that it is written once & can be use at different places through out the project. Second I want to get data in a combobox using that same connection & using a select query at the time of form load in C# Please suggest . THanks
-
Hi, I had a database in access I want to connect through connection string where shall I write the connection string so that it is written once & can be use at different places through out the project. Second I want to get data in a combobox using that same connection & using a select query at the time of form load in C# Please suggest . THanks
Jaleel Ahmed wrote:
where shall I write the connection string so that it is written once & can be use at different places through out the project
Generally it should be in your app.config file.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
-
Hi, I had a database in access I want to connect through connection string where shall I write the connection string so that it is written once & can be use at different places through out the project. Second I want to get data in a combobox using that same connection & using a select query at the time of form load in C# Please suggest . THanks
Jaleel Ahmed wrote:
Second I want to get data in a combobox using that same connection & using a select query at the time of form load in C#
Fire the query in the Form_Load event.
WP7.5 Apps - XKCD | Calvin | SMBC | Sound Meter | Speed Dial
-
Hi, I had a database in access I want to connect through connection string where shall I write the connection string so that it is written once & can be use at different places through out the project. Second I want to get data in a combobox using that same connection & using a select query at the time of form load in C# Please suggest . THanks
Hello, You can use below code to fill Combobox on your form load even.
private void Form1_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt = FillDT();
this.cmbTempControl.DataSource = dt;
this.cmbTempControl.ValueMember = "ID";
this.cmbTempControl.DisplayMember = "Name";
}protected DataTable FillDataTable() { DataTable dtTemp = new DataTable(); /\*Write here code to Fill your Datatable form Database \*/ return dtTemp; }
Thanks
KiranKumar Roy