c# - Modified Data Table -
for example have table
employeename empoyeeid john mark 60001 bent ting 60002 don park 60003
how can show employeeid have leading asterisk in data table? sample: *60001 *60002 *60003
public datatable listofemployee() { dataset ds = null; sqldataadapter adapter; try { using (sqlconnection mydatabaseconnection = new sqlconnection(myconnectionstring.connectionstring)) { mydatabaseconnection.open(); using (sqlcommand mysqlcommand = new sqlcommand("select * employee", mydatabaseconnection)) { ds = new dataset(); adapter = new sqldataadapter(mysqlcommand); adapter.fill(ds, "users"); } } } catch (exception ex) { throw new exception(ex.message); } return ds.tables[0]; }
i need show datatable in crystal report leading asterisk in employee id
public void employees() { reportdocument rptdoc = new reportdocument(); employees ds = new employees(); // .xsd file name datatable dt = new datatable(); // set name of data table dt.tablename = "employees"; dt = listofemployee(); //this function located below function ds.tables[0].merge(dt); string strreportname = "employees.rpt"; string strpath = application.startuppath + "\\reports\\" + strreportname; // .rpt file path below rptdoc.load(strpath); //set dataset report viewer. rptdoc.setdatasource(ds); reportviewer newreportviewer = new reportviewer(); newreportviewer.setreport(rptdoc); newreportviewer.show(); }
the easiest not best way data in format, if , if not meant used anywhere else. can in query
select '*'+id,col1,col2,col3 employee
though best way modify column value when consume it. more headache adding in query.
Comments
Post a Comment