This article describes the implementation method of C# asynchronous binding data. Share it for your reference. The details are as follows:
using System; using ; using ; using ; using ; using ; namespace WindowsApplication2 { public class AsyncCallBackOpeartion { private static DataGridView dataGridView; public static void AsyncCallBack(string connectionString, string sql, DataGridView dgv) { dataGridView = dgv; connectionString += ";Asynchronous Processing=true"; SqlConnection conn = new SqlConnection(connectionString); SqlCommand command = new SqlCommand(sql, conn); (); (new AsyncCallback(AsyncCallBack), command); } static void AsyncCallBack(IAsyncResult ar) { if () { SqlCommand com = (SqlCommand); SqlDataReader dr = (ar); DataTable dt = new DataTable(); (dr); (); if () { updateDG ur = new updateDG(dataBin); (ur, dt); } } } delegate void updateDG(DataTable dt); public static void dataBin(DataTable dt) { = dt; } } }
I hope this article will be helpful to everyone's C# programming.