如何使用C#和oracle 10g绕过crystalreport 2008中的登录 [英] how to bypass login in crystalreport 2008 using C# and oracle 10g
本文介绍了如何使用C#和oracle 10g绕过crystalreport 2008中的登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请告诉我如何使用C#和oracle 10g绕过水晶报告登录我正在制作基于windpw的应用程序
please tell me how to bypass login in crystal report using C# and oracle 10g I am making a windpw based application
推荐答案
查看本教程
C#Crystal Reports动态登录参数 [ ^ ]
您可以使用以下代码生成报告
You can use below code to generate the report
private void IntReport(string rptPath, string strServerName, string strDataBase, string strUserName, string strPassword)
{
try {
ReportDocument crReportDoc = new ReportDocument();
ConnectionInfo crpConnectionInfo = new ConnectionInfo();
TableLogOnInfo crpTableLogonInfo = new TableLogOnInfo();
Table tblCurrent = default(Table);
Sections crSections = default(Sections);
SubreportObject crSubreportObject = default(SubreportObject);
ReportObjects crReportObjects = default(ReportObjects);
ReportDocument crSubreportDocument = default(ReportDocument);
_crReportDoc.Load(rptPath);
crpConnectionInfo.AllowCustomConnection = true;
crpConnectionInfo.ServerName = strServerName;
crpConnectionInfo.DatabaseName = strDataBase;
crpConnectionInfo.UserID = strUserName;
crpConnectionInfo.Password = strPassword;
foreach ( tblCurrent in _crReportDoc.Database.Tables) {
crpTableLogonInfo = tblCurrent.LogOnInfo;
crpTableLogonInfo.ConnectionInfo = crpConnectionInfo;
tblCurrent.ApplyLogOnInfo(crpTableLogonInfo);
}
crSections = crReportDoc.ReportDefinition.Sections;
foreach (Section crSection in crSections) {
crReportObjects = crSection.ReportObjects;
foreach (ReportObject crReportObject in crReportObjects) {
if (crReportObject.Kind == ReportObjectKind.SubreportObject) {
crSubreportObject = (SubreportObject)crReportObject;
crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);
foreach ( tblCurrent in crSubreportDocument.Database.Tables) {
crpTableLogonInfo = tblCurrent.LogOnInfo;
crpTableLogonInfo.ConnectionInfo = crpConnectionInfo;
tblCurrent.ApplyLogOnInfo(crpTableLogonInfo);
}
}
}
}
crReportDoc.VerifyDatabase();
} catch (Exception ex) {
throw ex;
}
}
这篇关于如何使用C#和oracle 10g绕过crystalreport 2008中的登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文