c# - My datagridview ins't showing my data -
i have datagridview populating class library in c#. populate gridview calling method, fetchemployee() in employeedataaccess class returns datatable(dt). have set class bindingsource datagridview. however, datagridview populating first , last columns data. middle columns blank. binding method:
private void dgvemployeebindgrid() { dgvemployee.datasource = null; dgvemployee.datasource = employeedataaccess.fetchemployees(); }
this fetchemployee() method:
public static datatable fetchemployees() { datatable dt = new datatable(); using (sqlconnection conn = new sqlconnection(databaseconnection.test)) { conn.open(); using (sqlcommand cmd = conn.createcommand()) { cmd.commandtype = commandtype.storedprocedure; cmd.commandtext = "employee_fetch"; using (sqldataadapter sda = new sqldataadapter(cmd)) { using (dt) { sda.fill(dt); } } } return dt; }
basically, stored procedure says "select * employee"
my results show following:
empid value, next 3 columns (initials, fname, lname) blank , last column, active displaying appropriate check active or not checked inactive.
sorry, did not know how insert screen shot. can give me insight why middle rows have been omitted?
i able resolve error renaming public properties , private fields match sql data table fields referring to. happy again :)
Comments
Post a Comment