UDL file and SqlConnection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Hartnett

    UDL file and SqlConnection

    I just noticed that the SqlConnection class will not accept "file
    name=c:\SomeUDL .udl" as its connectionstrin g 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


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: UDL file and SqlConnection

    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.


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

    "Tom Hartnett" <THartnett@true mfg.com> wrote in message
    news:utg$tZ$ZDH A.1488@TK2MSFTN GP12.phx.gbl...[color=blue]
    > I just noticed that the SqlConnection class will not accept "file
    > name=c:\SomeUDL .udl" as its connectionstrin g 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[/color]
    rather[color=blue]
    > use it, but I don't want to hard-code my connection string into the app.
    >
    > Thanks in advance,
    > Tom
    >
    >[/color]


    Comment

    Working...