Page 1 of 1
How to use the same command(query) for different databases?
Posted: Wed Dec 25, 2013 10:49 am
by alk
We got stuck with that peculiarity that the command is strictly bound to the database. Our application connects to Access database or to MS SQL Server directly. We developed report queries to satisfy both SQL dialects, so don't need two separate commands for two databases. Is there any way to have single generic command for both databases to bind to the relevant database in run-time?
Re: How to use the same command(query) for different databas
Posted: Thu Dec 26, 2013 4:29 pm
by theregister
I'm interested in this as well.
Re: How to use the same command(query) for different databas
Posted: Fri Dec 27, 2013 7:03 am
by Alex K.
Hello,
In this case you can get data from necessary database in your application and pass it in report as DataSet.
Thank you.
Re: How to use the same command(query) for different databas
Posted: Fri Dec 27, 2013 7:52 am
by alk
Thank you for the reply.
Well, the question is how to use predefined columns then.
We designed the report and data filling based on some existing connection (say, StiOleDbSource over OleDb connection to an Access database). Evidently, we'd like to use the columns and their visual representation with the relevant data source in run-time, either for a new connection (MS SQL or Access) or DataSet, as you just specified.
How could we use the designed columns?
ps: I tried the approach with copying of columns as described in KB here -
http://support.stimulsoft.com/index.php ... connection, but failed - no data is displayed in the report.
Re: How to use the same command(query) for different databas
Posted: Fri Dec 27, 2013 8:20 am
by Alex K.
Thank you.
alk wrote: but failed - no data is displayed in the report.
Can you please send us a sample project which reproduce the issue for analysis.
Thank you.
Re: How to use the same command(query) for different databas
Posted: Fri Dec 27, 2013 2:14 pm
by alk
Aleksey wrote:
Can you please send us a sample project which reproduce the issue for analysis.
Thanks for the response.
Well, does it mean that the approach itself looks more-less correct from your point of view? You see, the original code is complex enough to be separated and shared with you in an easy way, so I'd try to dig a bit more by myself first. If I fail to find a solution I try to provide you with a sample project.
Re: How to use the same command(query) for different databas
Posted: Mon Dec 30, 2013 7:01 am
by Alex K.
Hello,
Yes, your way is correct. You can pass data as DataSet and also you can create a connection and datasources from code.
Please let us know if you need any additional help.
Thank you.
Re: How to use the same command(query) for different databas
Posted: Thu Jan 16, 2014 7:43 am
by alk
Thank you for the help , I coped with the issue basing on the example I mentioned.
Unfortunately, the approach doesn't work for migrating relationships because of field names mismatch, but we suggest a workaround for this.
Re: How to use the same command(query) for different databas
Posted: Thu Jan 16, 2014 8:49 am
by Alex K.
Hello,
Ok.
Let us know if you need any additional help.
Thank you.