Note that there are some explanatory texts on larger screens.

plurals
  1. POCrystal Reports XI + VB.NET 2008
    text
    copied!<p>I'm using <strong>VB.NET 2008 Professional</strong> with <strong>Crystal Reports Professional XI</strong> and with <strong>MSSQL Server 2008 Express</strong>.</p> <p>I've tried already to build a database with/or <strong>SQLDataReader</strong> and/or <strong>DataSet</strong> and use it with the Report Viewer, but it is not working properly. The following poblems occur:</p> <p>1- It does not consider the filters I put in the <strong>SQL command</strong>. The registers are always all shown. In the SQLCommand I create the following filters:</p> <p><code>AND SEG_Usuario.CD_Empresa = 'MTO' AND SEG_Sub_Processo.Nivel_1 &lt;&gt; 0 AND SEG_Usuario_Filial.CD_Filial = '010' AND SEG_Usuario.CD_Ususario = '9635'</code></p> <p>2- Registers shown are repeated, unordered and mixed.</p> <p>If I execute the SQL I use in the SQLCommand inside the database, database registers are displayed correctly, they don't repeat, they are ordered and only displayed according to what was asked by the filters. If I display the data that's in the DataTable and in the DataReader they're also correct, do not repeat, are ordered and are displayed according to what was set in the filters. So I believe the SQLCommand is with the SQL instruction written correctly.</p> <p>Basically I do the following operations:</p> <p><code>Dim conexao As SqlConnection = New SqlConnection("data source=meuservidor;initial catalog=meubanco;user id='meuuser';password='minhasenha'") Dim comando As SqlCommand = New SqlCommand</code></p> <p><code>Dim objdata As New DataTable Dim objdr As SqlDataReader</code></p> <p><code>comando.CommandText = "SELECT .... FROM .... WHERE ..... AND... AND ...ORDER BY ....." comando.Connection = conexao conexao.Open()</code></p> <p><code>objdr = comando.ExecuteReader objdata.Load(objdr)</code></p> <p><code>Dim myReport As New ReportDocument() 'I have already tried to load the report this way 'myReport.Load("\path\myReport.rpt")</code></p> <p><code>'Actually I load the report this way - I don't know if it makes any difference myreport.FileName = "\path\myReport.rpt"</code></p> <p><code>myreport.SetDatabaseLogon("meuser", ",minhasenha", "meuservidor", "meubanco")</code></p> <p><code>myReport.SetDataSource(objdata) CrystalReportViewer1.ReportSource = myReport</code></p> <p>I can't find out the error. Is there any other way to pass a SQL command to the report? Thanks a lot for the answers.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload