Hallo Albert,
ich würde meine Daten in ein Dataset laden, und dieses
Dataset an den Report übergeben. Somit kannst Du die
bestehende Verbindung verwenden. Ich gehe jetzt den Weg
übers Dataset. Ist leichter zu händeln (meiner Ansicht
nach).
Vielleicht hilft dir das nachstehende Beispiel.
cu
Alois
<<<<<
''Build a connection string
Dim connectionString As String = ""
connectionString = "Provider=SQLOLEDB;"
connectionString += "Server=" & SqlServer.Server
& ";Database=" & SqlServer.Database & ";"
connectionString += "User ID=" &
SqlServer.UserName & ";Password=" & SqlServer.UserPassword
''Create and open a connection using the
connection string
adoOleDbConnection = New OleDbConnection
(connectionString)
adoOleDbDataAdapter = New OleDbDataAdapter(SQL,
adoOleDbConnection)
dataSet = New DataSet
''Fill the dataset with the data retrieved. The
name of the table
''in the dataset must be the same as the table
name in the report.
adoOleDbDataAdapter.Fill(dataSet, Tabelle)
''Create an instance of the strongly-typed report
object
''Pass the populated dataset to the report
crReportDocument.SetDataSource(dataSet)
crReportDocument.RecordSelectionFormula =
ReportDocument.Formel
If ReportDocument.ReportTitle <> "" Then _
crReportDocument.SummaryInfo.ReportTitle =
ReportDocument.ReportTitle
''Set the viewer to the report object to be
previewed.
crv.ReportSource = crReportDocument
-----Originalnachricht-----
Hallo Thomas,
danke für deine Tipps.
Die Ursache für meinen Fehler war, dass die ReportSource
falsch angegeben
war.
Da die exe aus dem "\bin"-Ordner gestartet wird, ich
jedoch den Report im
".sln"-Entwicklungsverzeichnis hatte, wurde o.g. Fehler
erzeugt.
- ich greife auf eine passwort-geschützte Access-MDB zu,
aber wie?
(die entsprechenden logOnInfo.ConnectionInfo.Password,
etc. sind anscheinend
nicht dafür bestimmt)
- handelt es sich bei deinem Beispiel um einen "strongly
typed report" oder
um einen "non-typed report"?
Post by Thomas SchulzReportDoc = Application.StartupPath & _
"\Reports\MeinReport.rpt"
rpt.Load(ReportDoc) 'Report laden
Ciao, Albert
.