Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
Change label's button color when click with condition
Israel
Nov 3 2016 11:11 AM
221
Reply
Hi,
I have one label(lbl_signal):
Then when I run my program my label will receive data from a specific column's database like this:
string
connectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Foods\App_Data\office.mdb;Persist Security Info=False"
;
OleDbConnection
sqlCon = new
OleDbConnection
(connectionString);
sqlCon.Open();
string
commandString =
"select * from myTable where S ='" + "*" + "'"
;
OleDbCommand
sqlCmd =
new
OleDbCommand
(commandString, sqlCon);
OleDbDataReader
read = sqlCmd.ExecuteReader();
if
(read.HasRows)
{
while
(read.Read())
{
lbl_signal.Text = read[
"signal"
].ToString();
}
}
else
{
//line of code
}
read.Close();
sqlCon.Close();
Then if there is a word
connected
it's should be automatically in green's color. If its
disconnected
it's should be automatically in red's color.
How can I do it with a condition please?
Thanx,
Israel.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
performance issue
Json data to separate variables for saving in DB