How to stay connected to database until screen close?
问题 I developed a C# program for Windows-CE platform. The program open and close the connection to the database for every single interaction. See the code below. Button click: private void btnStkIn_Click(object sender, EventArgs e) { formStockIn = new frmStkIn(); formStockIn.Show(); } Select Data: try { using (SqlConnection sqlConn = new SqlConnection(<connection-string>)) { sqlConn.Open(); //Execute command SqlCommand sqlCmd = new SqlCommand(<Select Query>, sqlConn); SqlDataReader sqlReader =