I ve got a dataAdapter, dataSet and BindingSource on my forms to connect to an SQL database to show the data in the form, and it all works fine. However, I need to have 2 options of what server to connect to. e.g ISSPSQLEXPRESS and MY-WEB. I don t know how to do this and wondered whether anyone could give me some help on where to start? Thanks :) But when using the variables it says that it can t connect.
我用下面的法典说,它能够连接起来,这样一来就不问一米是否指变错?
sqlConnectionNW.ConnectionString = "Data Source=@server;Initial Catalog=Northwind;Integrated Security=True";
当我把法典修改到以下时,它就完美地运作。
sqlConnectionNW.ConnectionString = "Data Source=ISSPSQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True";