Page 1 of 1

read data from database using a command object

Posted: Fri Jul 18, 2014 3:26 am
by mihiri2
hi,

how can I use a command object in Report Begin render Event to read data from a database?

In this particular case, I do not want to use a data source but would like to do it using a command object


Thanks

Re: read data from database using a command object

Posted: Fri Jul 18, 2014 6:40 am
by HighAley
Hello.

Sorry, we don't understand your question. Could you describe your issue more detailed?
Could you specify what do you mean under "command object"?

Thank you.

Re: read data from database using a command object

Posted: Tue Jul 22, 2014 1:37 am
by mihiri2
I am interested in reading data directly from the database without using a data source as follows

Code: Select all

System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(
	((Stimulsoft.Report.Dictionary.StiSqlDatabase)this.Dictionary.Databases[0]).ConnectionString);
	try {
	  conn.Open();

      // Create table if it does not exist
System.Data.OleDb.OleDbCommand cmdCreate = conn.CreateCommand();
      try {
        cmdCreate.CommandText = @" Select Name from Project where Project =" + pProject;
	
        cmdCreate.ExecuteNonQuery();
      }
      catch { }		}
	finally {
	  conn.Close();
	}
In this , how can I actually read the data? How can I go through results of this data query?

thanks

Re: read data from database using a command object

Posted: Tue Jul 22, 2014 5:15 am
by HighAley
Hello.

Could you specify how this question is connectied with our product?
If you need to add data connection to the report then read Stimulsoft Reports.Net FAQ.

Thank you.

Re: read data from database using a command object

Posted: Wed Jul 23, 2014 11:16 pm
by mihiri2
I am trying to do this on Begin rendering event

Re: read data from database using a command object

Posted: Thu Jul 24, 2014 9:55 am
by HighAley
Hello.

Could you specify which version do you use?
Please, describe you issue more detailed.
What do you try to do? Why do you do this in Begin Render event?

Thank you.