Changing dataset connection string at runtime

后端 未结 3 1843
说谎
说谎 2021-01-02 06:14

I have a c# generated dataset. How can I change the connection string so I can use the dataset with another (identically structured yet differently populated) database? Th

3条回答
  •  佛祖请我去吃肉
    2021-01-02 06:35

    Based on the link above, I did it this way:

    partial class QueriesTableAdapter
    {
        public QueriesTableAdapter(string connectionString)
        {
            Properties.Settings.Default["connectionString"] = connectionString;
        }
    }
    

提交回复
热议问题