Ive decided to create a report based on an sql query...something like this:
Dim SqlConn As New SqlConnection("Data Source=PUIUALEX;User Id=Puiu;password=puiu2108;" & _
"Initial Catalog=ImageLibrary;")
Dim StrSql As String = "select Media.Description, Media.idmedia, count(*) as TotalDownloads from Media, Images, Requests where Media.idmedia=Images.idmedia AND Requests.idmedia=Media.idmedia AND Requests.aproved=T group by Media.Description, Media.idmedia"
Dim objDa As New SqlDataAdapter(StrSql, SqlConn)
Dim objDs As New DataSet
If SqlConn.State <> ConnectionState.Open Then
SqlConn.Open()
End If
objDa.Fill(objDs)
rpt.SetDataSource(objDs)
CrystalReportViewer1.ReportSource = rpt
DataBind()
-----------------------------------------------------------------------
rpt=report document
If I use the code above the report shows blank!
If I use instead rpt.SetDataSource(objDs.Tables(0)) i get the error: Invalid Table Number.
If i try to fill a datagrid instead of a report after the objDa.Fill(objDs) it works very well!
Any clues ??
Dim SqlConn As New SqlConnection("Data Source=PUIUALEX;User Id=Puiu;password=puiu2108;" & _
"Initial Catalog=ImageLibrary;")
Dim StrSql As String = "select Media.Description, Media.idmedia, count(*) as TotalDownloads from Media, Images, Requests where Media.idmedia=Images.idmedia AND Requests.idmedia=Media.idmedia AND Requests.aproved=T group by Media.Description, Media.idmedia"
Dim objDa As New SqlDataAdapter(StrSql, SqlConn)
Dim objDs As New DataSet
If SqlConn.State <> ConnectionState.Open Then
SqlConn.Open()
End If
objDa.Fill(objDs)
rpt.SetDataSource(objDs)
CrystalReportViewer1.ReportSource = rpt
DataBind()
-----------------------------------------------------------------------
rpt=report document
If I use the code above the report shows blank!
If I use instead rpt.SetDataSource(objDs.Tables(0)) i get the error: Invalid Table Number.
If i try to fill a datagrid instead of a report after the objDa.Fill(objDs) it works very well!
Any clues ??