sql server - Crystal Reports not loading data vb.net -
in project, have button that, when clicked, supposed print contracts active, sql server database. there hundreds of active contracts, @ moment, when press button, report form loads report doesn't.
i'll best demonstrate using images , code, able suggest why happens?
// code print button
private sub btnprintactive_click(sender object, e eventargs) handles btnprintactive.click try dim objlist new reportdocument objlist.load(readini("reports", directorypath & "connectionpaths.ini") & "\contractlist.rpt") dim info crystaldecisions.shared.tablelogoninfo info = new crystaldecisions.shared.tablelogoninfo() info.connectioninfo.databasename = "" info.connectioninfo.servername = readini("contractstring", directorypath & "connectionpaths.ini") info.connectioninfo.password = "" info.connectioninfo.userid = "" objlist.database.tables(0).applylogoninfo(info) objlist.recordselectionformula = "{tblcontracts.agreement} = 'active'" dim f frmreports f = new frmreports(con, acccon, "", 0, "", acccon, , objlist, , ) f.show() catch ex exception errorlog(ex.message, ex.stacktrace) msgbox("failed retrieve contract information 'database', refer error log") end try end sub
// report form, there no report
// proof there active reports
this fixed. problem was using 2 database tables in reports, providing login information 1, , second 1 wasn't receiving data server, hence why didn't display. other thing did, changed fact logging in blank values. fixed code this;
private sub btnprintactive_click(sender object, e eventargs) handles btnprintactive.click try dim objlist new reportdocument objlist.load(readini("reports", directorypath & "connectionpaths.ini") & "\contractlist.rpt") dim info crystaldecisions.shared.tablelogoninfo info = new crystaldecisions.shared.tablelogoninfo() dim servername string = (readini("sqlconnection", directorypath & "connectionpaths.ini", "servername")) dim database string = (readini("sqlconnection", directorypath & "connectionpaths.ini", "database")) dim username string = (readini("sqlconnection", directorypath & "connectionpaths.ini", "username")) dim password string = (readini("sqlconnection", directorypath & "connectionpaths.ini", "password")) dim provider string = (readini("sqlconnection", directorypath & "connectionpaths.ini", "provider")) info.connectioninfo.databasename = database info.connectioninfo.servername = servername info.connectioninfo.password = password info.connectioninfo.userid = username objlist.database.tables(0).applylogoninfo(info) objlist.database.tables(1).applylogoninfo(info) objlist.recordselectionformula = "{tblcontracts.agreement} = 'active'" dim f frmreports f = new frmreports(con, acccon, "", 0, "", acccon, , objlist, , ) f.show() catch ex exception errorlog(ex.message, ex.stacktrace) msgbox("failed retrieve contract information database, refer error log") end try end sub
Comments
Post a Comment