using i bilirsiniz.using System.Data;using System.Configuration;....bir de böyle deneyin ;public void InsertRow(string connectionString, string insertSQL){ using (OleDbConnection connection = new OleDbConnection(connectionString)) { // The insertSQL string contains a SQL statement that // inserts a new row in the source table. OleDbCommand command = new OleDbCommand(insertSQL); // Set the Connection to the new OleDbConnection. command.Connection = connection; // Open the connection and execute the insert command. try { connection.Open(); command.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.Message); } // The connection is automatically closed when the // code exits the using block. }}
Kullanım sonunda belirttiği gibi imleç using bloğundan çıktığı anda bağlantı kapatılacaktır.Bu özelliği bana hatırlatan Emre arkadaşıma teşekkürü bir borç bilirim.
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.