Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

DGV is not diplaying data

$
0
0
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");
                
            }


         }

        

    }     
}

Ezzz Mix




Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>