Hi,
1. I am using Visual Studio.NET 2005 C# Win Form
2. I have setup a database connection to my Access Database using ADO.NET
3. On my system timer I have the following code to execute every 1 sec:
[code=vbnet]
private void timer1_Tick(obj ect sender, EventArgs e)
{
OleDbConnection myConnection = new OleDbConnection (myConnectionSt ring);
OleDbCommand myCommand = new OleDbCommand("S ELECT *FROM Lights_Settings ", myConnection);
OleDbDataAdapte r myDataAdapter = new OleDbDataAdapte r(myCommand);
try
{
myConnection.Op en();
myDataAdapter.F ill(myDataSet, "Lights_Setting s");
this.textBox_no rth.DataBinding s.Clear();
this.textBox_no rth.DataBinding s.Add("text", myDataSet, "Lights_Setting s.North" );
myConnection.Cl ose();
}
catch (Exception ex)
{
MessageBox.Show ("Error reading database: " + ex.Message);
myConnection.Cl ose();
}
}
[/code]
4. The problem: If I change the values in the database table, when the timer ticks over again the text box value is not updated. If I remove the textbox_north.d atabindings.Cle ar() I will get an error because I am will be writing to the same databind twice.
Any Solutions??
thanks
1. I am using Visual Studio.NET 2005 C# Win Form
2. I have setup a database connection to my Access Database using ADO.NET
3. On my system timer I have the following code to execute every 1 sec:
[code=vbnet]
private void timer1_Tick(obj ect sender, EventArgs e)
{
OleDbConnection myConnection = new OleDbConnection (myConnectionSt ring);
OleDbCommand myCommand = new OleDbCommand("S ELECT *FROM Lights_Settings ", myConnection);
OleDbDataAdapte r myDataAdapter = new OleDbDataAdapte r(myCommand);
try
{
myConnection.Op en();
myDataAdapter.F ill(myDataSet, "Lights_Setting s");
this.textBox_no rth.DataBinding s.Clear();
this.textBox_no rth.DataBinding s.Add("text", myDataSet, "Lights_Setting s.North" );
myConnection.Cl ose();
}
catch (Exception ex)
{
MessageBox.Show ("Error reading database: " + ex.Message);
myConnection.Cl ose();
}
}
[/code]
4. The problem: If I change the values in the database table, when the timer ticks over again the text box value is not updated. If I remove the textbox_north.d atabindings.Cle ar() I will get an error because I am will be writing to the same databind twice.
Any Solutions??
thanks
Comment