Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
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:
HTML

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
Updated 2-Nov-16 2:06am
v2
Comments
[no name] 10-Sep-12 10:31am    
And?
ruchikdv 10-Sep-12 10:35am    
And??
The problem doesn't solve
If I remove that line. It works smooth
[no name] 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 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
[no name] 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.

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?
 
Share this answer
 
v2
Comments
Ruchik Vora 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 11-Sep-12 9:02am    
Does your report have parameters or formula fields? Perhaps one of those is creating the negative value?
Kschuler 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 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 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. :)
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
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900