C# 异步连接Sql Server数据库的方法,.net最新版提供了await方法,可以使我们可以很容易实现到数据库的异步连接
readonly string ConnectionString = "Data Source=database_server_name;Initial Catalog=Store;Integrated Security=True"; protected async void ExecuteCommandAsync() { using (SqlConnection con = new SqlConnection(ConnectionString)) { await con.OpenAsync(); } }