How to make a Label receive a text from the bank

1

Hello, I know the question is very simple, but I have a difficulty, I have a radio button and I would like the text to be received from a SQL Server database through a SELECT. I am using the Entity Framework. Please leave examples.

    
asked by anonymous 09.08.2016 / 18:32

1 answer

0

You can use the Checked property to set the value of your radioButton , but you need to know the type of data coming from your bank.

The Checked property expects a Boolean value, so if you have a string (varchar) stored in your database, you can convert the string as follows.

radioButton1.Checked = Convert.ToBoolean(dt.Rows["PerguntaUM"]);

as long as its value is either Yes or False.

In the case of text, you only have to use the Text property.

radioButton1.Text = dt.Rows["PerguntaUM"].ToString();
    
09.08.2016 / 19:01