Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

How to create queries independant of database

$
0
0

Hello,

I need to support multiple databases using Telerik data access. I am having issues in the specific case where I need to perform certain queries "by hand" by using the IdbCommand interface because specifying the query parameters  is different on the target database (:param with Oracle and @param with Firebird):

 // If Oracle

String autoSignQuery = "SELECT * FROM CREW_SCHED_FIELDS WHERE AUTO_SIGN_CHANGES = :AUTO_SIGN_CHANGES";

// If Firebird

String autoSignQuery = "SELECT * FROM CREW_SCHED_FIELDS WHERE AUTO_SIGN_CHANGES = @AUTO_SIGN_CHANGES";

command.CommandText = autoSignQuery;

var autoSign = command.CreateParameter();
autoSign.ParameterName = "@AUTO_SIGN_CHANGES";           // for Oracle :AUTO_SIGN_CHANGES
autoSign.Value = 0;
command.Parameters.Add(autoSign); 

var result = command.ExecuteReader();

 

Is there a simple way of building these queries in a generic way? Note that in my specific case I can't use link.

 

Thanks!

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>