How to use the same command(query) for different databases?
How to use the same command(query) for different databases?
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?
-
- Posts: 53
- Joined: Wed Nov 27, 2013 5:24 pm
Re: How to use the same command(query) for different databas
I'm interested in this as well.
Re: How to use the same command(query) for different databas
Hello,
In this case you can get data from necessary database in your application and pass it in report as DataSet.
Thank you.
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
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.
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
Thank you.
Thank you.
Can you please send us a sample project which reproduce the issue for analysis.alk wrote: but failed - no data is displayed in the report.
Thank you.
Re: How to use the same command(query) for different databas
Thanks for the response.Aleksey wrote: Can you please send us a sample project which reproduce the issue for analysis.
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
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.
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
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.
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
Hello,
Ok.
Let us know if you need any additional help.
Thank you.
Ok.
Let us know if you need any additional help.
Thank you.