I have problem that blocked my way to go further. I need to show Database field's bit(Boolean) value as Yes or No within two of them. How to solve this matter?
Here is the code:
public partial class Form1 : Form
{
string ConnString1 = "Data Source=192.168.1.xx;Initial Catalog=QCDETAILS;Persist Security Info=True;User ID=sa;Password=xxx-xx;";
BindingSource bs;
public Form1()
{
InitializeComponent();
}
private void preparingScrollingData()
{
using (SqlConnection con = new SqlConnection(ConnString1)) {
con.Open();
string strSqlCommand1 = "Select sSeriNum as [Serial Nm], bJudgement as Judgement FROM tbRecords";
using (SqlCommand command = new SqlCommand(strSqlCommand1, con)) {
SqlDataAdapter da = new SqlDataAdapter(command);
DataTable dt = new DataTable();
da.SelectCommand = command;
da.Fill(dt);
bs = new BindingSource();
// asagidaki eklendi
bs.DataSource = dt;
textBox1.DataBindings.Clear();
textBox1.DataBindings.Add(new Binding("Text", bs, "Serial Nm"));
rbYes.DataBindings.Clear();
rbYes.DataBindings.Add(new Binding("Checked", bs, "Judgement", true, DataSourceUpdateMode.OnPropertyChanged, true));
}
}
}
}