Help DataSet for WebReport

Help DataSet for WebReport
Code:

protected void Wrp_Usuario_StartReport(object sender, EventArgs e)
{
StringBuilder SqlQuery = new StringBuilder();
SqlCommand MsSql_Command = new SqlCommand();
SqlDataAdapter MsSql_DataAdapter = new SqlDataAdapter();
DataSet MsSql_DataSet = new DataSet();
SqlConnection MsSql_Connection;

string Cnx = "Data Source=10.1.1.10;Initial Catalog=db_univag;Persist Security Info=True;User ID=univagweb2;Password=**********";

SqlQuery.AppendLine(" SELECT TOP 50 ");
SqlQuery.AppendLine(" codigo ");
SqlQuery.AppendLine(" , funcionario ");
SqlQuery.AppendLine(" , nome_completo ");
SqlQuery.AppendLine(" , nome_login ");
SqlQuery.AppendLine(" FROM usuario ");

MsSql_Connection = new SqlConnection(Cnx);
MsSql_Command.Connection = MsSql_Connection;
MsSql_Command.CommandType = CommandType.Text;
MsSql_Command.CommandTimeout = 300;
MsSql_Command.CommandText = SqlQuery.ToString();
MsSql_DataAdapter.SelectCommand = MsSql_Command;
MsSql_DataAdapter.Fill(MsSql_DataSet, "usuario");

MsSql_Connection.Dispose();
MsSql_Connection.Close();

if (MsSql_DataSet.Tables["usuario"].Rows.Count > 0)
{
Report report = Wrp_Usuario.Report;
report.RegisterData(MsSql_DataSet.Tables["usuario"], "usuario");
}

}


Thank you!!
Matheus Vinicios
Cuiab??/MT - Brazil

Comments

  • edited 10:13PM
    Hello,

    Everything seems correct. What is your question? >
  • The WebReport not update when you run the database of this method. Is there a solution?
  • edited 10:13PM
    I want to look at the report file. Please attach it here or send to tz@fast-report.com.
  • edited 10:13PM
    Try to change your code ("usuario" -> "Usuario"):

    report.RegisterData(MsSql_DataSet.Tables["usuario"], "Usuario");
  • AlexTZ, have sent an attachment in your e-mail. 'm On Hold. Thank you for your help.
  • AlexTZ, worked out to God. But he can not be the same as the table name of the dataset? Explain me please?
    What better product for me to buy? Here the company is education and medium enterprises.
    Thank you!
  • edited 10:13PM
    wrote:
    But he can not be the same as the table name of the dataset? Explain me please?
    Your report has an embedded datasource with "Usuario" name. This code just replaces the embedded datasource with the new one (from your application).
    wrote:
    What better product for me to buy?
    Since you use ASP.NET, you need FastReport.Net Win+Web, or FastReport.Net Professional (if you need source code).
  • What is the difference between Single, Team and Site?
  • edited 10:13PM
    Single = 1 developer
    Team = upto 4 developers
    Site = unlimited number of developers in one company

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.