質問は次のとおりです。これは、VS での実行がインストールされたアプリの実行と異なるために発生しますか? とにかくレポートが DB に接続しようとするのはなぜですか? どうすれば制御できますか?
レポートの内容に応じて制御できます
レポートに 1 つのテーブルが含まれていて、このテーブルを DataTable を使用してレポートに渡した場合、レポートは正常に機能します。
ただし、データテーブルがすべてのレポートデータを提供しない場合、通常はレポートに2つ以上のテーブルが含まれている場合、レポートは元のDBの場所に接続しようとします
この場合、すべてのテーブルを含むレポートに DATASET を渡す必要があります
ここで、著者とタイトル著者の2つのテーブルを使用した私のコード
'Build a SQL statement to query for the authors table
Dim sqlString As String = "SELECT * FROM authors"
'Retrieve the data using the SQL statement
adoOleDbDataAdapter = New OleDbDataAdapter(sqlString, adoOleDbConnection)
'Build a SQL statement to query for the titleauthor table
sqlString = "SELECT * FROM titleauthor"
'Retrieve the data using the SQL statement
adoOleDbDataAdapter2 = New OleDbDataAdapter(sqlString, adoOleDbConnection)
'Create a instance of a Dataset
DataSet1 = New DataSet()
'Fill the dataset with the data with author information
adoOleDbDataAdapter.Fill(DataSet1, "authors")
'Fill the dataset with the data with titleauthor information.
'The table name used in the Fill method must be identical to the name
'of the table in the report.
adoOleDbDataAdapter2.Fill(DataSet1, "titleauthor")
'Pass the dataset to the report
crReportDocument.Database.Tables(0).SetDataSource(DataSet1)
'View the report
CrystalReportViewer1.ReportSource = crReportDocument