SHARE
TWEET

fetch db to grid

a guest Sep 17th, 2019 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. koneksikuDataContext dbku = new koneksikuDataContext();
  2.             msemployee mep = new msemployee();
  3.             DataGridView datagrid = new DataGridView();
  4.             BindingSource bs = new BindingSource();
  5.  
  6.             var ambil = (from s in dbku.msemployees select s).First();
  7.             datagrid.ColumnCount = 6;
  8.             datagrid.AutoGenerateColumns = false;
  9.             //DataTable dt = new DataTable();
  10.             //SqlDataAdapter sda = new SqlDataAdapter();
  11.             //sda.Fill(dt);
  12.  
  13.             datagrid.Columns[0].HeaderText = "EmployeeID";
  14.             datagrid.Columns[0].DataPropertyName = "employeeid";
  15.             datagrid.Columns[1].HeaderText = "Name";
  16.             datagrid.Columns[1].DataPropertyName = "name";
  17.             datagrid.Columns[2].HeaderText = "Email";
  18.             datagrid.Columns[2].DataPropertyName = "email";
  19.             datagrid.Columns[3].HeaderText = "Password";
  20.             datagrid.Columns[3].DataPropertyName = "password";
  21.             datagrid.Columns[4].HeaderText = "HandPhone";
  22.             datagrid.Columns[4].DataPropertyName = "handphone";
  23.             datagrid.Columns[5].HeaderText = "Position";
  24.             datagrid.Columns[5].DataPropertyName = "position";
  25.             this.datagrid.DataSource = datagrid;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top