1. using is used to operate databases. using is an abbreviation of resource release. It is used to implement the IDisposable interface (the interface for releasing object Resources is IDisposable) private void button2_Click (object sender, routedEventArgs e) {// The point used by the source field indicates that the local machine can use an IP address if it is another machine. (the local machine can also use 127.0.0.1) using (SqlConnection conn = new SqlConnection ("Data Source = 127.0.0.1; Initial Catalog = OrderDB; User ID = sa; Password = 123456789") {conn. open (); // Open the connection using (SqlCommand cmd = conn. createCommand () {// insert data cmd. commandText = "insert into admin (name, password, rank) values ('hello', '000000', 1)"; cmd. executeNonQuery ();} using (SqlCommand cmd = conn. createCommand () {// use cmd for the parameter. commandText = "select * from admin where rank = @ rank"; cmd. parameters. add (new SqlParameter ("@ rank", 2); // because SqlDataReader implements the IDisposable interface, the interface for releasing object Resources is IDisposable using (SqlDataReader reader = cmd. executeReader () {// the query results are not stored in the database on the client. You can use DataSet to process while (reader. read () {string name = (string) reader. getString (0); MessageBox. show (name );}}}}}