Using Resources for SQL

  • Thread starter Thread starter Marc Stober
  • Start date Start date
M

Marc Stober

Hi,

I am thinking that it would be a good idea to use .NET resources to
store SQL statements that would otherwise be hard-coded into an
application. I could even store them in a text file as shown in
<http://msdn.microsoft.com/library/en-us/cpguide/html/cpconresourcesinte
xtfileformat.asp>. But I don't see any examples of using resources this
way or how to instantiate a ResourceManager from a text file, so I'm
wondering if I'm going about this the best way? Note that I'm using
WebMatrix to build an ASP.NET application so I'm not explicitly
compiling the resources into an assembly or anything.

Thank you in advance,
Marc
 
Marc,

The first question I would ask is why you aren't using stored
procedures. This would provide a definite performance advantage.

The only benefit that you gain from having the SQL statements in a
resource file is if you have to change the statements. If you do this, you
have to assure that the result set is processed correctly, as the schema of
the result set might change.

Also, since there is only one SQL dialect for the data source you are
using (it's not like human languages, for SQL server, there is only one
language, for Access, there is only one language, etc, etc), it probably
wouldn't hurt to place them in an assembly of some sort. The resource file
does not seem well suited for this kind of thing.

Hope this helps.
 
Back
Top