水晶报表13中的登录失败 [英] Logon Failed in crystal report 13

查看:64
本文介绍了水晶报表13中的登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在这里,我正在使用c#开发一个桌面应用程序.在那个项目中,我使用了具有ms访问权限的crystalreport作为数据库.但是在运行时,当我打开报告时,它询问用户名和密码,我没有给数据库任何密码,动态地我已经设置了服务器名和数据库,但是它不起作用.相同的代码正在另一个报表中运行,并且很好地打开了它.这是我的代码

Hi,

Here i am developing one desktop application by using c#. In that project am using crystalreport with ms access as database. But at the time of running when i am opening report it is asking user name and password, I havnt given any password for database,dynamically i have set servername and database, but it not working. The same code is working in another report and its opening very well. Here is my code

OleDbCommand cmdGet = new OleDbCommand("SELECT * FROM supp_due where suppid= ''" + TextBox2.Text.Trim() + "''", MyCon.Con);
          
            OleDbDataAdapter adGet = new OleDbDataAdapter(cmdGet);
            DataSet dsGet = new DataSet();
            adGet.Fill(dsGet, "supp_due");
 SupplierRpt2 _SupRpt = new SupplierRpt2();
            _SupRpt.DataSourceConnections[0].SetConnection(Application.StartupPath.ToString(), "Shop.mdb","","");
            _SupRpt.SetDataSource(dsGet);
            
            CrystalReportViewer1.ReportSource = _SupRpt;
            
            CrystalReportViewer1.Refresh();



所以请救救我

谢谢
Sujith



So please help me

Thanks
Sujith

推荐答案

尝试下面的代码仅更改内部的类和方法
Try Below code only change the class and method inside
DataTable dt = new DataTable();
         dt = Module.fillgridProject();
            try
            {
                if (dt.Rows.Count > 0)
                {
                    ReportDocument rptdoc = new ReportDocument();
                    rptdoc.Load(Server.MapPath("~\\Reports\\ModuleReport.rpt"));
                    rptdoc.SetDataSource(dt);
                    //crv.ReportSource = rptdoc;
                    //crv.DataBind();
                    ExportOptions exportOpts1 = rptdoc.ExportOptions;
                    rptdoc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                    rptdoc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    rptdoc.ExportOptions.DestinationOptions = new DiskFileDestinationOptions();
                    ((DiskFileDestinationOptions)rptdoc.ExportOptions.DestinationOptions).DiskFileName = Server.MapPath("ProjectReport.pdf");
                    rptdoc.Export();
                    rptdoc.Close();
                    rptdoc.Dispose();
                    Response.ClearContent();
                    Response.ClearHeaders();
                    Response.ContentType = "application/pdf";
                    Response.AppendHeader("Content-Disposition", "attachment; filename=ProjectReport.pdf");
                    Response.WriteFile("ProjectReport.pdf");
                    Response.Flush();
                    Response.Close();
                   System.IO.File.Delete(Server.MapPath("ProjectReport.pdf"));
                }
                else
                {
                    Messagebox1.Show("No Record for this Project");
                }
            }
            catch 
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Hello", "javascript:alert('No Data Present');", true);
            }


这篇关于水晶报表13中的登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆