January 23, 2016

Displaying data from Database to comboBox in C#

private void GetMachine()
        {
            SqlDataAdapter d = new SqlDataAdapter("select * from machine", con);
            DataTable dt = new DataTable();
            d.Fill(dt);
            cmbMachineType.DataSource = dt;
            cmbMachineType.DisplayMember = "machinetype";
        }

No comments:

Post a Comment