mandelbrot Posted January 23, 2006 Posted January 23, 2006 Hi Everyone, Not sure if I've posted this in the right place, as it could be perceived as being rather general... But here goes - I want to embed '%SystemRoot%' as part of a constant for a connection string. Will this work, or do I need to define a structure or class instead to lock the value of the variable (i.e. return a read only property)? Thanks in advance, Paul. Quote
IxiRancid Posted January 30, 2006 Posted January 30, 2006 System.Environment.GetEnvironmentVariable("SystemRoot") this will do the job, however, it won't work in web.config or perhaps some other configuration file. You'd need to code it. Quote
mandelbrot Posted January 30, 2006 Author Posted January 30, 2006 Yep - I know about the Environment class, but unfortunately you cannot use functions like this to define constants. I suppose, really, I'll just have to test my theories to see if they work or not. I should be asking "Were the SQL/OLEDB libraries written using VS.NET?", and I'd probably get an answer along the lines of: No - they were written using either C++ or ASM. And this lead me logically to the question: It's not written on the VS.NET platform, therefore can I feed environment variables to the target library and expect them to work. Thanks for your help there, Rancid - I'll give it a test and post back when I've come to a conclussion. Regards, Paul. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.