Failed to generate a user instance of SQL Server

Discussion in 'Databases' started by Leemg, Mar 3, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Connection String - grrrr!

    OK, I have created a simple site in asp.net with a sql express 2008 DB, the database resides in the app_data folder and works fine when I test the app locally, however when I publish the site on on my DASP account and attempt to use my hosted DB it does not work. Not sure if it matters but my DASP account is Windows 2003 - IIS 6.0 and my sites target Framework is 3.5

    My connection strings in my webconfig look like so (I have been commenting out the local one when publishing and vice versa, I'm sure that is not the way it's done:confused:)

    <connectionStrings>
    <add name="NetbookStoreConnectionString" connectionString="server=(local)\SQLExpress;AttachDbFileName=|DataDirectory|NetbookStore.mdf;Integrated Security=true;User Instance=true" />
    <add name="NetbookStoreConnectionString" connectionString="Data Source=tcp:sql2k802.discountasp.net;Initial Catalog=SQL2008_572409_netbookstore;User ID=*****;Password=********;" />
    </connectionStrings>

    I know this question has been asked time and time again but can someone please provide a complete beginners guide to the connection string, or point me in the right direction?

    This is driving me crazy :mad:

    Thanks
     
  2. Hi,
    Did you use the Attach tool to get your Express DB on-line?
    I've created Webcasts on how to do this:
    http://iis7test.com/webcasts/

    Let me know of any additional help you need.
    Salute,
    Mark
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    what do you mean it doesn't work? What is the error?
     
  4. Hi guys,
    Thansk for the response.

    The DB is attached, Mark I followed your webcast to do this.
    The connection string in my web config is the one from the tool.

    With regard the - it doesn't work comment.
    Apologies I know that is possibly the most vague comment ever :rolleyes:

    I am using a simple form with a submit button that should insert a record in to the database. I do not receive any error, (I havent put anything in the code to catch exceptions) but there is no data being inserted in to the database. This works fine when running locally and referring to my connection string using the name in the webconfig as below so I was under the impression I could jusr replace that connection string with the one generated by the attach tool and off I went ?

    <connectionStrings>
    <add name="NetbookStoreConnectionString" connectionString="server=(local)\SQLExpress;Attach DbFileName=|DataDirectory|NetbookStore.mdf;Integra ted Security=true;User Instance=true" />
    <add name="NetbookStoreConnectionString" connectionString="Data Source=tcp:sql2k802.discountasp.net;Initial Catalog=SQL2008_572409_netbookstore;User ID=*****;Password=********;" />
    </connectionStrings>
     
  5. Hi,
    Try it like this, just edit your username and password but leave the other parts as is.

    <connectionStrings>
    <clear/>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sql2k802.discountasp.net;Initial Catalog=SQL2008_572409_netbookstore;User ID=*****;Password=********" providerName="System.Data.SqlClient"/>
    <remove name="NetbookStoreConnectionString"/>
    <add name="NetbookStoreConnectionString" connectionString="Data Source=tcp:sql2k802.discountasp.net;Initial Catalog=SQL2008_572409_netbookstore;User ID=*****;Password=********" providerName="System.Data.SqlClient"/>
    </connectionStrings>
     
  6. Thanks Mark, that has worked!
     
  7. Sticky note this

    This thread made more sense and got me connected. Wisemx that last example is good enough even for an old geek to figure out ! Many Thanks.
     
  8. I truly enjoy hearing back from anyone when things work out, thanks. ;-)
     
  9. wisemx, thanks! I was planning on a difficult afternoon but I able to get my site up and running in less then an hour by following your directions. Awesome job!
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page