Use Procedures
Use Procedures
Hi,
I want to use procedure in a report but with himself not to understand like using it. That I am making bad.
Dim cnnSQL As New SqlConnection(StrCnnSrv("GPMMNET"))
Dim dsReport As New DataSet
Dim tbReport As New DataTable
Dim cmdReport As New SqlCommand("RebutsSelIdRebut", cnnSQL)
cmdReport.CommandType = CommandType.StoredProcedure
cmdReport.Parameters.Add("@vREBUT_ID", SqlDbType.BigInt).Value = LlistaRebuts.ActiveItem.Key
Dim daReport As New SqlDataAdapter
daReport.SelectCommand = cmdReport
daReport.Fill(dsReport, "TREBUTS")
cnnSQL.Open()
Try
cmdReport.ExecuteNonQuery()
tbReport = dsReport.Tables("TREBUTS")
If tbReport.Rows.Count > 0 Then
Dim ReportRebut As StiReport = New StiReport
ReportRebut.Load(Application.StartupPath & "\\Reports\rptRebutId.mrt")
ReportRebut.Compile()
ReportRebut.Dictionary.Databases.Clear()
ReportRebut.Dictionary.DataStore.Clear()
ReportRebut.CompiledReport.DataStore.Clear()
Dim dbReport As Stimulsoft.Report.Dictionary.StiSqlDatabase = TryCast(ReportRebut.Dictionary.Databases("GPMMNET"), Stimulsoft.Report.Dictionary.StiSqlDatabase)
If dbReport IsNot Nothing Then
dbReport.ConnectionString = StrCnnSrv("GPMMNET")
End If
ReportRebut.Dictionary.Databases.Add(New StiSqlDatabase("conRpt", StrCnnSrv("GPMMNET")))
ReportRebut.RegData("dsRpt", tbReport)
ReportRebut.Dictionary.Synchronize()
ReportRebut.Dictionary.DataSources(0).Name = "dsRpt"
ReportRebut.Dictionary.DataSources(0).Alias = "dsRpt"
ReportRebut.Render()
ReportRebut.Show()
End If
End If
Catch ex As SqlException
MessageBox.Show("Error: " & ex.ErrorCode, varNomAplicacio, MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message, varNomAplicacio , MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
cnnSQL.Close()
dsReport.Dispose()
daReport.Dispose()
tbReport.Dispose()
cmdReport.Dispose()
End Try
Tank You.
I want to use procedure in a report but with himself not to understand like using it. That I am making bad.
Dim cnnSQL As New SqlConnection(StrCnnSrv("GPMMNET"))
Dim dsReport As New DataSet
Dim tbReport As New DataTable
Dim cmdReport As New SqlCommand("RebutsSelIdRebut", cnnSQL)
cmdReport.CommandType = CommandType.StoredProcedure
cmdReport.Parameters.Add("@vREBUT_ID", SqlDbType.BigInt).Value = LlistaRebuts.ActiveItem.Key
Dim daReport As New SqlDataAdapter
daReport.SelectCommand = cmdReport
daReport.Fill(dsReport, "TREBUTS")
cnnSQL.Open()
Try
cmdReport.ExecuteNonQuery()
tbReport = dsReport.Tables("TREBUTS")
If tbReport.Rows.Count > 0 Then
Dim ReportRebut As StiReport = New StiReport
ReportRebut.Load(Application.StartupPath & "\\Reports\rptRebutId.mrt")
ReportRebut.Compile()
ReportRebut.Dictionary.Databases.Clear()
ReportRebut.Dictionary.DataStore.Clear()
ReportRebut.CompiledReport.DataStore.Clear()
Dim dbReport As Stimulsoft.Report.Dictionary.StiSqlDatabase = TryCast(ReportRebut.Dictionary.Databases("GPMMNET"), Stimulsoft.Report.Dictionary.StiSqlDatabase)
If dbReport IsNot Nothing Then
dbReport.ConnectionString = StrCnnSrv("GPMMNET")
End If
ReportRebut.Dictionary.Databases.Add(New StiSqlDatabase("conRpt", StrCnnSrv("GPMMNET")))
ReportRebut.RegData("dsRpt", tbReport)
ReportRebut.Dictionary.Synchronize()
ReportRebut.Dictionary.DataSources(0).Name = "dsRpt"
ReportRebut.Dictionary.DataSources(0).Alias = "dsRpt"
ReportRebut.Render()
ReportRebut.Show()
End If
End If
Catch ex As SqlException
MessageBox.Show("Error: " & ex.ErrorCode, varNomAplicacio, MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message, varNomAplicacio , MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
cnnSQL.Close()
dsReport.Dispose()
daReport.Dispose()
tbReport.Dispose()
cmdReport.Dispose()
End Try
Tank You.
Use Procedures
Hello.
Please change your code as follows:
Thank you.
Please change your code as follows:
Code: Select all
If tbReport.Rows.Count > 0 Then
Dim ReportRebut As StiReport = New StiReport
ReportRebut.Load(Application.StartupPath & "\\Reports\rptRebutId.mrt")
ReportRebut.Dictionary.Databases.Clear()
ReportRebut.Dictionary.DataStore.Clear()
ReportRebut.Compile()
ReportRebut.RegData("dsRpt", "dsRpt", tbReport)
ReportRebut.Dictionary.Synchronize()
ReportRebut.Show()
End If
Use Procedures
Thank you very much by its aid, continuous without working.
When I execute of procedure gives back the data, but in report no. In the report the consultation of procedure works. Where I am being mistaken
When I execute of procedure gives back the data, but in report no. In the report the consultation of procedure works. Where I am being mistaken
Use Procedures
Hello, Ramond.
Please replace tbReport.Show() command with tbReport.Design() command. In the Designer please check that the name of the DataSource is 'dsRpt' and you had used the DataSource with that name during designing of the report.
If you still have problems with your application, then send a test solution with a data to support[at]stimulsoft.com for analysis, please.
Thank you.
Please replace tbReport.Show() command with tbReport.Design() command. In the Designer please check that the name of the DataSource is 'dsRpt' and you had used the DataSource with that name during designing of the report.
If you still have problems with your application, then send a test solution with a data to support[at]stimulsoft.com for analysis, please.
Thank you.
Use Procedures
Hello Edward,
Now with this code it works in design but not in show. Where I am being mistaken?
Dim ReportRebut As StiReport = New StiReport
ReportRebut.Load(Application.StartupPath & "\\Reports\rptRebut.mrt")
ReportRebut.Dictionary.Databases.Clear()
ReportRebut.Dictionary.DataStore.Clear()
ReportRebut.Compile()
tbReport.TableName = "dsRpt"
ReportRebut.RegData("conRpt", "conRpt", tbReport)
ReportRebut.Dictionary.DataSources.Clear()
ReportRebut.Dictionary.Synchronize()
ReportRebut.Design()
Now with this code it works in design but not in show. Where I am being mistaken?
Dim ReportRebut As StiReport = New StiReport
ReportRebut.Load(Application.StartupPath & "\\Reports\rptRebut.mrt")
ReportRebut.Dictionary.Databases.Clear()
ReportRebut.Dictionary.DataStore.Clear()
ReportRebut.Compile()
tbReport.TableName = "dsRpt"
ReportRebut.RegData("conRpt", "conRpt", tbReport)
ReportRebut.Dictionary.DataSources.Clear()
ReportRebut.Dictionary.Synchronize()
ReportRebut.Design()
Use Procedures
Please try to delete the following line of code:
I think that second time you do not need to call it.
Thank you.
Code: Select all
ReportRebut.Dictionary.DataSources.Clear()
Thank you.
Use Procedures
tanks Edward, now already I understand as it works
Use Procedures
Please let us know if any help is required.
Thank you.
Thank you.