error - Stimulsoft report with asp.net

Stimulsoft Reports.NET discussion
Post Reply
speed_dre
Posts: 4
Joined: Tue Jul 29, 2008 9:27 am

error - Stimulsoft report with asp.net

Post by speed_dre »

I am trying to pass a parameter with one page in asp.net, but i am having some problems.
When I write a number in a text box and click to show the report, i see this message error:

"Object reference not set to an instance of an object."

The butto have this code:

Dim report As Stimulsoft.Report.StiReport = New Stimulsoft.Report.StiReport()
Try
report.Load("C:\report.mrt")
Catch ex As Exception
MsgBox("Load Error Report (Destination)")
End Try
report.Compile()
report.CompiledReport.DataSources.Item("employee").Parameters.Item("@id").ParameterValue = txtid.Text
report.Render()
StiWebViewer1.Report = report
StiWebViewer1.Visible = True



and in the datasource "employee" in the report - stimulsoft.net is:

select * from dbo.AC_employee where identifier = @id


I make only that, i need to make more things and how i resolve this problems?
Thanks,
Felipe Chimenti
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

error - Stimulsoft report with asp.net

Post by Edward »

Hello Felipe.

Sorry for my automatically error. Instead of MsgDlg please write:

MessageBox.Show(ex.Message)

Also please be careful with assigning of the following default value of the id parameter as it might be not initialized.

report.CompiledReport.DataSources.Item("employee").Parameters.Item("@id").ParameterValue = 1

Because when the report objects are created txtid.Text might be not initialized.

also please change report.Render() to report.Render(false) for the Web because rendering dialog is not available in the web right now.

Thank you.
speed_dre
Posts: 4
Joined: Tue Jul 29, 2008 9:27 am

error - Stimulsoft report with asp.net

Post by speed_dre »

But in the report, in the stimulsoft, i need to create a parameter...how we were making.....need to make another things?
Thanks a lot Edward,
Felipe Chimenti - Brasil.......
speed_dre
Posts: 4
Joined: Tue Jul 29, 2008 9:27 am

error - Stimulsoft report with asp.net

Post by speed_dre »

I put this code below in the asp.net code:

report.CompiledReport.DataSources.Item("employee").Parameters.Item("@id").ParameterValue = 1

but the error continue appearing...


Dim report As Stimulsoft.Report.StiReport = New Stimulsoft.Report.StiReport()
Try
report.Load("C:\report.mrt")
Catch ex As Exception
MsgBox("Load Error Report (Destination)")
End Try
report.Compile()
report.CompiledReport.DataSources.Item("employee").Parameters.Item("@id").ParameterValue = 1
report.CompiledReport.DataSources.Item("employee").Parameters.Item("@id").ParameterValue = txtid.Text
report.Render(False)
StiWebViewer1.Report = report
StiWebViewer1.Visible = True
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

error - Stimulsoft report with asp.net

Post by Edward »

Please see testing WebSite in the attachment. In that example you can see how to work with parameters in Web environment.

Please let me know if any helpis required.

For work it it requires NWind.mdb file which comes with a standard installation of Stimulsoft Reports.Net.

Thank you.
Attachments
89.ParametersWeb.zip
(6.03 KiB) Downloaded 183 times
speed_dre
Posts: 4
Joined: Tue Jul 29, 2008 9:27 am

error - Stimulsoft report with asp.net

Post by speed_dre »

Thanks a lot Edward,
For your help by the forum and by email.
huahauahuaha
Thanks,
Felipe Chimenti
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

error - Stimulsoft report with asp.net

Post by Edward »

You are welcome. :)

Thank you.
Post Reply