Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...