Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ADO.NET VB.NET CrystalReports , +
I am having a problem on the line
report.setdatasource(datatable)
The crystal report is created with datasource being local dataset
while setting the datasource I populate the datatable (same column names as the dataset) with the values
On reaching that line I get this error:

CrystalDecisions.CrystalReports.Engine.InvalidArgumentException was unhandled
  Message=
Error in File temp_d2d17ab8-3746-4cba-a8ba-b92d2a3505a4 {74F89B47-DB88-4A0C-BA00-E9DD157AFCD9}.rpt:
Invalid negative value.
  Source=CrystalDecisions.ReportAppServer.DataSetConversion
  StackTrace:
       at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)
       at Project.PurcahseOrder.makereport() in C:\Users\DART\Desktop\Nirav MYS (10.09.12)\Project(Nirav)\Project\PurcahseOrder.vb:line 1367
       at Project.PurcahseOrder.btnConfirm_Click(Object sender, EventArgs e) in C:\Users\DART\Desktop\Nirav MYS (10.09.12)\Project(Nirav)\Project\PurcahseOrder.vb:line 1074
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at Project.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Runtime.InteropServices.COMException
       ErrorCode=-2147483076
       Message=
Error in File temp_d2d17ab8-3746-4cba-a8ba-b92d2a3505a4 {74F89B47-DB88-4A0C-BA00-E9DD157AFCD9}.rpt:
Invalid negative value.
       Source=""
       StackTrace:
            at CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.ReplaceConnection(Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault)
            at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
            at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
       InnerException:
Posted 10-Sep-12 5:30am
Edited 10-Sep-12 5:31am
v2
Comments
Wes Aday at 10-Sep-12 10:31am
   
And?
ruchikdv at 10-Sep-12 10:35am
   
And??
The problem doesn't solve
If I remove that line. It works smooth
Wes Aday at 10-Sep-12 10:38am
   
That is complete nonsense. And what is your question? You must have had a question to ask. Or did you just want us to know that you have an invalid argument?
Ruchik Vora at 10-Sep-12 23:00pm
   
A. The question obviously is how to solve it
B. The information about this error is hardly available
C. Before jumping to conclusions think from the point of view of someone posting the question. We aren't smart enough but we expect you to be. So better understand that
Wes Aday at 11-Sep-12 7:30am
   
How exactly is this obvious? It might be obvious to you but it's not obvious to anyone else. For all we know you don't know what "negative" means. This is just a stack trace with no supporting information. No presentation of the data being passed through, no code that demonstrates your problem, and no effort made to solve the problem.
C. What conclusions did I jump to? I did not jump to any conclusions. If I had, I would have posted a nonsensical solution to a problem that does not yet exist. The only conclusion that I could possibly jump to is that you did not bother reading the posting guidelines before just posting a stack trace and expecting a miracle.
Kschuler at 11-Sep-12 17:29pm
   
That's a nice thought, but we simply don't have enough information to just tell you how to fix it. When dealing with Crystal Reports, you can't just copy and paste code into the question very easily...since we can't see what you are doing in the report have to tell us about it. The error says that there is an invalid negative. So the way to solve it is to find out where you have an invalid negative. We can't get any more specific about how to solve it until you give us more information about how your report is setup. Are you using parms? Sub reports? Grouping? Formula fields? Graphs? There are a number of reasons you could get an error like this and without seeing the report we can't help you. So tell us more about your report.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

To me, the important part of this error message is this:
Invalid negative value
 
It sounds like your Crystal Report is expecting a positive numeric value in your report but you are passing in a negative one. Check your data. If you're passing incorrect data, then fix that. If a negative value is allowed, then check your Crystal Report and make sure it is expecting negative values.
 
-- Update --
It could also be that the Crystal Report is expecting a negative value, but not one in the range that you have sent. So perhaps you are sending a very large negative number?
  Permalink  
v2
Comments
Ruchik Vora at 10-Sep-12 23:01pm
   
Thanks Kschuler for replying
But I have filled the table myself with positive integers using a loop
I do not seem to find where the negative value then comes!
Kschuler at 11-Sep-12 9:02am
   
Does your report have parameters or formula fields? Perhaps one of those is creating the negative value?
Kschuler at 11-Sep-12 17:31pm
   
Perhaps including more code showing us how you are filling your dataset will help us get to the bottom on this. You can click the Improve Question link to edit your question and add more details.
ruchikdv at 12-Sep-12 1:41am
   
I understand Kschuler, I did not provide enough information for you to help me in the best possible manner. My mistake.
Currently the problem is solved.
I will explain the problem:
There was only a datatable from local dataset and some text objects in my CR
There was no question of a negative value error since there were no formula or any other constraint/complexity in the report
Turns out the error was due to negative value of FirstLineIndent property
On making it positive the error was solved
Thanks a lot Kschuler for giving your precious time to the same
Regards,
Ruchik Vora
Kschuler at 12-Sep-12 9:07am
   
Glad to hear that you've solve it. You might want to add your own solution to this question and mark it as correct so that others who have the same or similar questions can see it better. And it's not a mistake to not include enough info. Especially with Crystal Report questions. It's always hard to know what info is helpful and what isn't. And it's hard to post code because with Crystal there isn't much actual code, it's all these little settings and property windows. I never would have come up with checking the value of the FirstLineIndent property. :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

There was only a datatable from local dataset and some text objects in my CR There was no question of a negative value error since there were no formula or any other constraint/complexity in the report Turns out the error was due to negative value of FirstLineIndent property On making it positive the error was solved
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 381
1 Sergey Alexandrovich Kryukov 245
2 Marcin Kozub 225
3 Praneet Nadkar 217
4 /\jmot 189
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100