UDL file and SqlConnection

  • Thread starter Thread starter Tom Hartnett
  • Start date Start date
T

Tom Hartnett

I just noticed that the SqlConnection class will not accept "file
name=c:\SomeUDL.udl" as its connectionstring property. However, the
OleDbConnection class will use it. Can anyone tell me why?

If the SqlConnection class is optimized to work with SQL Server, I'd rather
use it, but I don't want to hard-code my connection string into the app.

Thanks in advance,
Tom
 
Tom,

You will have to find some way of getting the connection string from the
UDL file and then passing it to the SqlConnection class. The UDL file is
for OLEDB, so that is why it doesn't work. I think that what you can do is
take everything after the "Provider" section (not including the provider
name) and then use that.

Hope this helps.
 
Back
Top