Page 1 of 1

error - Stimulsoft report with asp.net

Posted: Tue Jul 29, 2008 9:31 am
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

error - Stimulsoft report with asp.net

Posted: Tue Jul 29, 2008 9:43 am
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.

error - Stimulsoft report with asp.net

Posted: Tue Jul 29, 2008 10:22 am
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.......

error - Stimulsoft report with asp.net

Posted: Tue Jul 29, 2008 10:30 am
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

error - Stimulsoft report with asp.net

Posted: Tue Jul 29, 2008 7:13 pm
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.

error - Stimulsoft report with asp.net

Posted: Wed Jul 30, 2008 12:13 pm
by speed_dre
Thanks a lot Edward,
For your help by the forum and by email.
huahauahuaha
Thanks,
Felipe Chimenti

error - Stimulsoft report with asp.net

Posted: Wed Jul 30, 2008 12:55 pm
by Edward
You are welcome. :)

Thank you.