Using Resources for SQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marc Stober

    #1

    Using Resources for SQL


    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...nresourcesinte
    xtfileformat.as p>. 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

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Using Resources for SQL

    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.

    --
    - Nicholas Paldino [.NET/C# MVP]
    - nicholas.paldin o@exisconsultin g.com

    "Marc Stober" <marcstober@yah oo.com> wrote in message
    news:%23$B2UrGf DHA.2344@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    >
    > 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...nresourcesinte
    > xtfileformat.as p>. 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
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]


    Comment

    Working...