客户端中的Crystal Report错误 [英] Crystal Report error in client

查看:86
本文介绍了客户端中的Crystal Report错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Oracle 11g在C#4.0中开发了一个桌面应用程序,并在VS 2010中使用了Crystal报表



它在开发机器中执行和运行良好我创建了一个设置文件



在客户端系统中我安装了oracle客户端和我的应用程序的安装文件



能够使用应用程序,直到我生成任何水晶报告



有关调用

实时(JIT)的详细信息,请参阅此消息的结尾调试而不是此对话框。

**************异常文本**************

System.ArgumentOutOfRangeException:长度不能小于零。

参数名称:长度

在System.String.InternalSubStringWithChecks(Int32 startIndex,Int32 length,Boolean fAlwaysCopy)

在System.String.Substring (Int32 startIndex,Int32长度)

at Visitor_Management_System.VisitorIDReportWindow.VisitorIDReportWindow_Load(Object sender,EventArgs e)

at System.Windows.Forms.Form.OnLoad(EventArgs e)

在System.Windows.Forms.Form.OnCreateControl()

在System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

在System.Windows.Forms.Control.CreateControl()

在System.Windows.Forms.Control.WmShowWindow(Message&m)

在System.Windows.Forms.Control .WndProc(Message&m)

在System.Windows.Forms.ScrollableControl.WndProc(Message&m)

在System.Windows.Forms.Form.WmShowWindow(Message&m)

在System.Windows.Forms.Form.WndProc(Message&m)

在System.Windows.Forms.Control.ControlNativeWindow.OnMess年龄(消息&m)

在System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&m)

在System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd) ,Int32 msg,IntPtr wparam,IntPtr lparam)



即使我点击继续向我询问服务器用户名和密码



在网上搜索时,有想法在编码中声明名称和密码,所以我修改了CrystalReport的Form Load_event编码,如下所示但没有用

private void VisitorIDReportWindow_Load(object sender,EventArgs e)

{

if(this.CON.State.Equals(System.Data.ConnectionState.Open))

{

CON.Close();

}

CON.Open();

DataTable DTB;

string query1 =从VMS_VISITOR中选择*,其中PASSNUMBER ='+ V​​isitorCreationWindow.PNBR +';

使用(OLCMND1 =新的OracleCommand(query1,CON))

{

using(OADAP1 = new OracleDataAdapter(OLCMND1))

{

DTB = new DataTable();

OADAP1.Fill(DTB);

}

}

RDT = new ReportDocument();

string reportpath = System.Windows.Forms.Application.StartupPath.Substring(0,System.Windows.Forms.Application.StartupPath.Substring(0,System.Windows.Forms.Application.StartupPath.LastIndexOf (\\))。LastIndexOf(\\));

reportpath + = @\ VisitorIDReport.rpt; // string reportpath =D:\\Visitor Management System \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

RDT.Load(reportpath);

ConnectionInfo connectioninfo = new ConnectionInfo();

connectioninfo.DatabaseName =ORCL;

connectioninfo.UserID =itapps;

connectioninfo.Password =it123;

Logindetailforreport(connectioninfo,RDT);

VisitorIDCrystalReportViewer.ReportSource = RDT;

RDT.SetDataSource(DTB);

}

对于异常,我无法理解..

I developed a desktop application in C# 4.0 with Oracle 11g & used Crystal report for VS 2010

it executing & running fine in developement machine & i created a setup file

In client system i installed oracle client and setup file of my application

able to use the application well until i generate any crystal report

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.String.Substring(Int32 startIndex, Int32 length)
at Visitor_Management_System.VisitorIDReportWindow.VisitorIDReportWindow_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

2nd even if i click continue its asking me server username & password

when searched in net, there are ideas to declare the name & password in coding so i modified coding for CrystalReport's Form Load_event like below but no use
private void VisitorIDReportWindow_Load(object sender, EventArgs e)
{
if (this.CON.State.Equals(System.Data.ConnectionState.Open))
{
CON.Close();
}
CON.Open();
DataTable DTB;
string query1 = "Select * from VMS_VISITOR where PASSNUMBER ='" + VisitorCreationWindow.PNBR + "'";
using (OLCMND1 = new OracleCommand(query1, CON))
{
using (OADAP1 = new OracleDataAdapter(OLCMND1))
{
DTB = new DataTable();
OADAP1.Fill(DTB);
}
}
RDT = new ReportDocument();
string reportpath = System.Windows.Forms.Application.StartupPath.Substring(0,System.Windows.Forms.Application.StartupPath.Substring(0,System.Windows.Forms.Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
reportpath += @"\VisitorIDReport.rpt"; //string reportpath = "D:\\Visitor Management System\\Visitor Management System\\VisitorIDReport.rpt";
RDT.Load(reportpath);
ConnectionInfo connectioninfo = new ConnectionInfo();
connectioninfo.DatabaseName = "ORCL";
connectioninfo.UserID = "itapps";
connectioninfo.Password = "it123";
Logindetailforreport(connectioninfo,RDT);
VisitorIDCrystalReportViewer.ReportSource = RDT;
RDT.SetDataSource(DTB);
}
And for exception i am not able to get any idea..

推荐答案

Quote:

System.ArgumentOutOfRangeException:Length不能小于零。

参数名称:长度

System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

我认为你在这一行搞乱了一些事情,纠正它。

I think you're messing something on this line, correct it.

string reportpath = System.Windows.Forms.Application.StartupPath.Substring(0,System.Windows.Forms.Application.StartupPath.Substring(0,System.Windows.Forms.Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));




引用:

2nd即使我点击继续它问我服务器用户名&密码

2nd even if i click continue its asking me server username & password

检查此答案

Crystal Report登录提示 [ ^ ]

Check this answer
Crystal Report Login Prompt[^]

引用:

在网上搜索时,有想法声明名称&编码中的密码,所以我修改了CrystalReport的Form Load_event编码,如下所示但没有用

when searched in net, there are ideas to declare the name & password in coding so i modified coding for CrystalReport's Form Load_event like below but no use

确保你做对了。

C# Crystal Reports动态登录参数 [ ^ ]

Make sure you did right.
C# Crystal Reports Dynamic Logon parameters[^]


这篇关于客户端中的Crystal Report错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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