namespace Wpf_intrfce
{
public partial class reademp : Window
{
SqlConnection cn;
SqlDataAdapter da;
DataSet ds2;
public reademp()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
// con string, and con.open();
if (radioButton1.IsChecked == true)
{
da = new SqlDataAdapter ("SELECT * FROM emptbl",cn);
ds2 = new DataSet();
da.Fill(ds2);
dataGrid1.ItemsSource = ds2.Tables[0].DefaultView;
MessageBox.Show("All data Displayed");
}
else if (radioButton2.IsChecked == true)
{
da = new SqlDataAdapter("SELECT * FROM emptbl" + " WHERE Emp_Id = ' ' " + Textbox1.Text + " ' AND " + " Emp_Name= ' ' " + Textbox2.Text+ " ' ", cn);
ds2 = new DataSet();
da.Fill(ds2);
dataGrid1.ItemsSource = ds2.Tables[0].DefaultView;
MessageBox.Show("Specified data Displayed");
}
}
}
}
{
public partial class reademp : Window
{
SqlConnection cn;
SqlDataAdapter da;
DataSet ds2;
public reademp()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
// con string, and con.open();
if (radioButton1.IsChecked == true)
{
da = new SqlDataAdapter ("SELECT * FROM emptbl",cn);
ds2 = new DataSet();
da.Fill(ds2);
dataGrid1.ItemsSource = ds2.Tables[0].DefaultView;
MessageBox.Show("All data Displayed");
}
else if (radioButton2.IsChecked == true)
{
da = new SqlDataAdapter("SELECT * FROM emptbl" + " WHERE Emp_Id = ' ' " + Textbox1.Text + " ' AND " + " Emp_Name= ' ' " + Textbox2.Text+ " ' ", cn);
ds2 = new DataSet();
da.Fill(ds2);
dataGrid1.ItemsSource = ds2.Tables[0].DefaultView;
MessageBox.Show("Specified data Displayed");
}
}
}
}
Ezzz Mix