Author |
Message |
dery
Newbie
Joined: 18 Apr 2016
Online Status: Offline
Posts: 5
|
Topic: index0 hors limites Posted: 03 May 2016 at 10:51pm |
Bonjour,
j'ai une petite exception crystal report (for VS2010) qui m’embête depuis quelques mois, j'espère que quelq'un d'entre vous pourra m'aider,
quand j'imprime la première fois mon rapport ça marche, je ferme le rapport et je click une deuxième fois pour lancer le rapport il me donne une exception:
L'exception ArgumentOutOfRangeException n'a pas été gérée
L'index 0 est hors limites.
Nom du paramètre : index
je travaille sur windows 7, visual studio 2010 et crystal report for vs2010
Merci d'avance
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|
Posted: 10 May 2016 at 11:51am |
I'm sorry, dery, but these forums are in English only. From what I understand, you're using the Crystal for VS SDK to run a report and getting an exception.
Please make sure that you're using the latest service pack (16) which can be downloaded from here: http://scn.sap.com/docs/DOC-7824. Use the "Install Executable" to get integration into Visual Studio.
If you're on the latest version, please post the code where you're seeing the error.
-Dell
|
|
IP Logged |
|
dery
Newbie
Joined: 18 Apr 2016
Online Status: Offline
Posts: 5
|
Posted: 11 May 2016 at 9:45pm |
Thank you verry much Dell, I wrote my question in French because I'm not well in English. you inderstood well my problem, so my code is like this:
StatistiqueTableAdapter.Fill(MyDataSet.Statistique, date1.Value.Date.ToShortDateString(), date2.Value.Date.ToShortDateString());
ImpressionForm.crystalReportViewer1.ReportSource = ImpressionForm.EtatStatistique;(here my exception)
ImpressionForm.EtatStatistique.SetDataSource(MyDataSet);
ImpressionForm.ShowDialog();
ImpressionForm.Dispose();
when I remove the last line, the exception desapear, but I don't understand why, I have used this code many times before with Visual Studio 2008 and it workes perfectelly.
Can you tell me how can I make sure that I'm using the latest service pack? plesase,
Thanks again,
Sorry for my bad English
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|
Posted: 12 May 2016 at 3:47am |
Latest Service Pack: Go to Control Panel >> Programs and Features. Look for "SAP Crystal Reports for Visual Studio..." which will tell you the service pack you have installed.
Error:
Does EtaStatistique exist (non-null value) when your code is called?
Does EtaStatistique have data in it when your code is called?
Have there been any changes to the DataSet since you created the report? Edit the report. On the Crystal Reports menu, go to "Database" and select "Verify Database". This will make sure that the report is looking for the current version of the Dataset.
-Dell
|
|
IP Logged |
|
dery
Newbie
Joined: 18 Apr 2016
Online Status: Offline
Posts: 5
|
Posted: 14 May 2016 at 11:37pm |
Hi,
EtaStatistique exists, it's a report that I have created to be used,
it has data, the fisrt time when it's called there is no problem, but when it's recalled a second time whith the same parameters it gives the exception,
I've refresh my databse in crystal reports, so there are no changes in the dataset
have a good day
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|
Posted: 16 May 2016 at 3:21am |
Do you ever explicitly .Close() and .Dispose() the report itself? I usually put that code in the FormClosing event handler.
-Dell
|
|
IP Logged |
|
dery
Newbie
Joined: 18 Apr 2016
Online Status: Offline
Posts: 5
|
Posted: 16 May 2016 at 11:30pm |
I put the .Dispose() of my report when I call it (like the code above), I have the exception
I tried to put .Dispose() and .Close() in my formClosing event handler, but it's the same: I have the exception
I remove completely .Dispose() from my code, there is no problem
Thank you
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|
Posted: 17 May 2016 at 3:36am |
Your code above disposes the form, not the report. Also, you should call .Close() before calling .Dispose().
How are you assigning the data source to the report in your code? Also, do you ever instantiate the form itself?
I might do something like this:
ImpressionForm iFrm = new ImpressionForm(this);
StatistiqueTableAdapter.Fill(MyDataSet.Statistique, date1.Value.Date.ToShortDateString(), date2.Value.Date.ToShortDateString());
iFrm.crystalReportViewer1.ReportSource = iFrm.EtatStatistique;
iFrm.EtatStatistique.SetDataSource(MyDataSet);
iFrm.ShowDialog();
iFrm.crystalReportViewer1.ReportSource.Close();
iFrm.CrystalReportViewer.ReportSource.Dispose();
iFrm.Dispose();
You'll have to tweak this to user the exact classes from your application to get it to work correctly.
|
|
IP Logged |
|
dery
Newbie
Joined: 18 Apr 2016
Online Status: Offline
Posts: 5
|
Posted: 17 May 2016 at 4:17am |
The problem that I've, is that:
iFrm.crystalReportViewer1.ReportSource. has not .Close()
iFrm.CrystalReportViewer.ReportSource. has not .Dispose();
The possibilities given are: .Equals, .GetHashCode, .GetType and .ToString()
I think I tried that before asking you.
Thanks a lot.
|
IP Logged |
|
|