Ciao.
Ho creato dall'ide di VS 2005 Pro un report (myReport.rpt) che si appoggia su 3 tabelle.
Per visualizzarlo uso un CrystalReportViewer.
Alla pressione di un pulsante visualizzo il report.
Ecco il codice:
Dim connectionString As String
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\csv\modelnet.mdb"
Dim oledbconnection As OleDbConnection = New OleDbConnection(connectionString)
Dim stringaSQL As String
stringaSQL = "SELECT * FROM Taglie"
Dim dadapter As OleDbDataAdapter = New OleDbDataAdapter(stringaSQL, oledbconnection)
oledbconnection.Open()
Dim dtablerep As DataTable = New DataTable("TabReport")
Dim mioReport As New myReport
dadapter.Fill(dtablerep)
mioReport.Load("C:\...\myReport.rpt")
mioReport.SetDataSource(dtablerep)
My.Forms.FormReport.CrystalReportViewer1.ReportSource = mioReport
My.Forms.FormReport.Show()
Ho utilizzato deliberatamente la query :
stringaSQL = "SELECT * FROM Taglie"
per vedere se riesco a forzare il datasource del report da codice.... ma nulla da fare.... il report continua a comportarsi come specificato a design time e pesca i dati da tutte e 3 le tabelle.
Come posso fare per specificare un datasource che derivi da una query SQL ????
Grazie a tutti.
Ciao!