c# - Binding data source to Crystal Reports -
i new crystal reports
crystal viewer showing data table first instead of give data source, , every time need refresh crystal viewer.
private void crystalreportviewer1_load(object sender, eventargs e) { string str = configurationmanager.connectionstrings["conndata"].connectionstring.tostring(); sqlconnection con = new sqlconnection(str); string cellno = loginuser.cellno; sqlcommand cmd = new sqlcommand("sp_get_customerbycellno", con); cmd.parameters.addwithvalue("@cell", cellno); sqldataadapter da = new sqldataadapter(cmd); datatable dt = new datatable(); da.fill(dt); int = dt.rows.count; reportdocument rd = new reportdocument(); connectioninfo info = new connectioninfo(); info.databasename = "billingandaccounts"; info.userid = "sa"; info.password = "sa123"; rd.verifydatabase(); rd.load(@"c:\users\abhinavu\documents\login\login\orderwindow.rpt"); rd.setdatasource(dt); crystalreportviewer1.reportsource = rd; }
hi if want pass datase report have use typed dataset , use on report.
from see in snippet of code can imagine created report based on oledb , ado.net connection ot on dataset.
connectioninfo info = new connectioninfo(); info.databasename = "billingandaccounts"; info.userid = "sa"; info.password = "sa123"; rd.verifydatabase(); here have 2 links show how create report using ado.net datasets datasource
Comments
Post a Comment