Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8540

Re: Setting the sql statement

$
0
0

it what you are saying a code like the one below? Some reports are build by defining a sql in the report through the database Expert / add command. If done this way there is always just one kinda "table" in the report, namely the command. Setting the dataset with report.setDatasource will in this case always work. But about 70% of our customers reports are created by adding each table in the "database Expert" using the add table to report and then linking the report together. I DONT think we have any reports that is only showing data from just 1 table. If we use the report.setDatasource on a report that has more that 1 table, and is not created using the command object, then in some cases it will fail (just stalling, and use all the power of the IIS). Try Dim conn As New SqlConnection(connString) Dim commandReport As Boolean = False conn.Open() Dim sd As New SqlDataAdapter(New SqlCommand(nySQL, conn)) Dim ds As New Data.DataSet() For Each mnTable In report.Database.Tables sd.Fill(ds, mnTable.name) If mnTable.Name.ToUpper() = "COMMAND" Then commandReport = True End If Next If commandReport = True Then report.SetDataSource(ds.Tables(0)) Else report.SetDataSource(ds.Tables(1)) End If report.SetDataSource(ds) conn.Close() Catch ex As Exception Throw End Try


Viewing all articles
Browse latest Browse all 8540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>