Crystal Reportsを書き直す作業がありました。私は元のレポートを1999年頃に見つけ、VS 2008でそれらを開いて変更を加えて保存しました。オブジェクトデータセットを使用したCrystalレポート
今、それらはもはや周囲のデータベースを参照します。だから、私はこのデータソースを削除し、.NET OBJECTデータソースを追加しました。フィールドがこの新しいデータソースを参照するように、すべてを変更しました。
私の意図は、レポートを作成し、実行時にデータテーブルに渡すことでした。このテーブルは作成されたsprocを実行することによって作成されます。
私が実行すると、レポートの最初のページが表示されます。私はページまたはプリントを変更しようとすると、しかし、私はエラーを取得する:ここで
Logon failed. Details: crdb_adoplus : Object reference not set to an instance of an object. Error in File C:...\MR01 {8E5164A9-4B01-4019-81E6-87AED65A02DF}.rpt: Unable to connect: incorrect log on parameters
は私のコードは次のとおりです。
<CR:CrystalReportViewer ID="theCrystalReportViewer" visible="false" runat="server" EnableDatabaseLogonPrompt="false" />
Dim theDataTable As DataTable = tbl
theDataTable.TableName = "tableName"
Dim oReport As New ReportDocument
Dim sRptPath As String = "...Reports\MR01.rpt"
oReport.Load(sRptPath)
oReport.SetDataSource(theDataTable)
'oReport.SetDatabaseLogon("####", "####", "####", "#####")
Dim c As ConnectionInfo = New ConnectionInfo()
c.ServerName = "####"
c.DatabaseName = "####"
c.Password = "####"
c.UserID = "####"
c.Type = ConnectionInfoType.SQL
c.IntegratedSecurity = False
For i As Integer = 0 To theCrystalReportViewer.LogOnInfo.Count - 1
theCrystalReportViewer.LogOnInfo(i).ConnectionInfo = c
Next
'theCrystalReportViewer.EnableDatabaseLogonPrompt = False
'theCrystalReportViewer.DisplayGroupTree = False
theCrystalReportViewer.ReportSource = oReport
theCrystalReportViewer.DataBind()
litMsg.Visible = False
theCrystalReportViewer.Visible = True
ありがとうございますが、それは私が探していたものではありません。この記事では、カスタムデータセットを手動で入力してレポートにプッシュする方法を示します。私はsprocで満たされたカスタムデータセットを作成し、それをレポートにプッシュしたいと考えています。 – user1310989
レポートをsprocに直接接続するのではなく、データセット経由でsproc結果を渡す目的は何ですか? –