Question Tidy string storage

GILow

New member
Joined
Sep 9, 2008
Messages
2
Programming Experience
3-5
Hello all,

I am looking for a neat way to handle storage of strings in code. Often I write very long and complex SQL queries, that are "one off", i.e. not used by any other application, so I am reluctant to turn them into a stored procedure.

On the other hand, storing them in the code itself is very messy, often these strings run to 10 or more lines of code.

Does anyone have a suggestion of how to store these sorts of strings in some kind or associated resource file, to keep the code ledgible? (I've posted here rather than the database forums as I really see this as a tidy coding issue, rather than a database issue.)

Thank you,

Matthew
 
Hello.

Visual Studio offers the option to save Strings as Resources, have a look at the My Project Properties.

You could also declare them in an extra module as constants. Or you store them in a custom INI or XML-File, which would also be a way.

Bobby
 
Thanks for that, I'll try the resource option first and see how that goes. Like a lot of these things, I find the hard part is knowing what to look for to get started.
 
Back
Top