none
Typed DataSet using Settings.Settings. How to get it to use Machine.Config? RRS feed

  • Question

  • I created a DataSet by going rick click project > add new item > add DataSet

    I then opened my Server Browser, and click/dragged the tables I wanted onto the DataSet

     

    Everything is working fine, except when I moved the app to another pc, I found it wasn't connecting using my Machine.Config ConnectionString. It's using the Settings.Settings connection string which I didn't even realize was there

    I tried deleting the Settings.Settings connection string but the DataSet doesn't build then

     

    How can I get my DataSet to use the Machine.Config ConnectionString ?

    Or is there a different way I should be doing this?

    Sunday, May 16, 2010 11:26 PM

Answers

  • Just found out how!

    I added this to the Machine.Config, and it overrides the Settings.Settings one

    <add name="ProjectName.Properties.Settings.ConnectionStringName"
        connectionString="Data Source=ServerName;Initial Catalog=Databasename;Integrated Security=True"
        providerName="System.Data.SqlClient" />

     

    The key was getting the correct name. Previously I was just putting ConnectionStringName, and not the rest


    • Marked as answer by mejobloggs Sunday, May 16, 2010 11:50 PM
    Sunday, May 16, 2010 11:50 PM