read data from database using a command object

Stimulsoft Reports.NET discussion
Post Reply
mihiri2
Posts: 43
Joined: Mon Apr 08, 2013 2:29 am

read data from database using a command object

Post 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
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: read data from database using a command object

Post 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.
mihiri2
Posts: 43
Joined: Mon Apr 08, 2013 2:29 am

Re: read data from database using a command object

Post 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
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: read data from database using a command object

Post 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.
mihiri2
Posts: 43
Joined: Mon Apr 08, 2013 2:29 am

Re: read data from database using a command object

Post by mihiri2 »

I am trying to do this on Begin rendering event
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: read data from database using a command object

Post 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.
Post Reply