c# - Failed to retrieve data from database -
i'm trying use crystal reports , connect stored procedure takes 2 parameters.
the user fills 2 text boxes , i'm trying pass these parameters stored procedure.
but error
failed retrieve data database
here code
private void button1_click(object sender, eventargs e) { if (check(txtfrmdt, txttdt)) { cryrpt = new reportdocument(); crtablelogoninfos = new tablelogoninfos(); crtablelogoninfo = new tablelogoninfo(); crconnectioninfo = new connectioninfo(); cryrpt.load("e:\\users\\mostafa\\documents\\visual studio 2013\\projects\\sales , inventory system\\sales , inventory system\\inventory_report.rpt"); parameterfields = new crystaldecisions.shared.parameterfields(); parameterfield = new parameterfield(); parametervalue = new parameterdiscretevalue(); parameterfield.name = "@param1"; parametervalue.value = txtfrmdt.text; parameterfield.currentvalues.add(parametervalue); parameterfields.add(parameterfield); cryrpt.setparametervalue("@param1", parametervalue); parameterfield.name = "@param2"; parametervalue.value = txttdt.text; parameterfield.currentvalues.add(parametervalue); parameterfields.add(parameterfield); cryrpt.setparametervalue("@param2", parametervalue); crconnectioninfo.servername = "mostafa-pc"; crconnectioninfo.databasename = "sales , inventory system"; crconnectioninfo.userid = "sa"; crconnectioninfo.password = "1"; crtables = cryrpt.database.tables; foreach (crystaldecisions.crystalreports.engine.table crtable in crtables) { crtablelogoninfo = crtable.logoninfo; crtablelogoninfo.connectioninfo = crconnectioninfo; crtable.applylogoninfo(crtablelogoninfo); } crystalreportviewer1.reportsource = cryrpt; crystalreportviewer1.refresh(); } }
what should do?
Comments
Post a Comment