on 08-26-2015 4:14 AM
Hi,
I'm trying to dynamically get my data source from my database using a query but it shows the wrong report source even though the query and data source is correct.
Public DA As New SqlDataAdapter
Public DS As DataSet
Public Function executeViaSQL(ByVal sqlquery As String) As DataSet
DS = New DataSet
DA = New SqlDataAdapter(sqlquery, Conn)
DA.Fill(DS, 0)
Return DS
End Function
Private Sub formload
Dim RS As New rptDaily
DS = New DataSet
DS = executeViaSQL(query) 'query is public and has a stored query
RS.Load()
RS.SetDataSource(DS.Tables(0))
CrystalReportViewer1.ReportSource = RS
End Sub
The report is showing the default report source even though I've set the report source to a dataset from my database.
Hi John
Make sure the report does not have the "Saved Data" option enabled. Also, at least for testing purposes enable the option "Verify on 1st refresh".
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow me on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SQL Server 2008
VS 2010
Crystal Reports 13.0.2000.0
Public connectionString As String = ""
Public Conn As SqlConnection
Public Class sqlConn
Public Sub OpenConn()
Try
Dim sr As New StreamReader(Application.StartupPath & "\SqlConnection.dll") 'Connection string
connectionString = sr.ReadLine
Conn = New SqlConnection(connectionString)
Conn.Open()
sr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
'Above codes is in a module
Private SQL As New sqlConn
Sub loadMainForm
SQL.OpenConn()
End sub
Hi John
Please see the wiki Troubleshooting Issues with VS .NET Datasets and Crystal Reports - Business Intelligence (BusinessOb... for troubleshooting steps with datasets.
- Ludek
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.