Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fred Kazarian 4 posts 25 karma points
    May 23, 2012 @ 17:30
    Fred Kazarian
    0

    Connection string with an instance in umbracoDbDSN problem

    I can't connect to my database because the connection string with an instance in umbracoDbDSN converts the slash that denotes the instance to a double slash. So for example:

    <add key="umbracoDbDSN" value="MyServer\sqlexpress; database=umbraco4; user id=sa; password=XXXX" />

    when I debug the code, I see it uses the connection string

    MyServer\\sqlexpress; database=umbraco4; user id=sa; password=XXXX

    If I place a \\ instaed, it doubles that too and the result is \\\\ (4 slashes)

    Can someone help me please :) ?

    Thanks

     

  • JotaBe 6 posts 27 karma points
    Feb 24, 2013 @ 02:29
    JotaBe
    0

    In C# backslash is a escape character. I.e, a tab is \t.

    As backslash is an escape character, if you want to insert a backslash in an string you have to type two backslashes together.

    The debugger uses exactly the same syntax, so when you see two backslashes in the debugger there is only one. And when you see four, there are in fact two backslashes.

    The real problem is that your connection string is missing the "server=" part from "server=MyServer\sqlexpress". Add the missing "server=" and it should work fine.

     

Please Sign in or register to post replies

Write your reply to:

Draft