in c# global connection to be used in all classes

后端 未结 5 1875
萌比男神i
萌比男神i 2021-01-22 18:59

I\'ve a connection string saved to Properties.Settings.Default, i need to use an sql connection in all classes without having to declare it everytime, so how should

5条回答
  •  攒了一身酷
    2021-01-22 19:04

    Whenever you instantiate a new object pass to its constructor a reference to that connection.

提交回复
热议问题