优化数据库连接示例代码:string insertQuery = “Insert into student (ID, sName, sGrade, sSex, sEmail, sPhone, sAddress)” + “Values(‘2000131500145’, ‘小张’, ‘男‘, ‘test@test.com’, ” + “‘027-87364884’, ‘宏博公寓’); SqlConnection conn = new SqlConnection(connectionString); SqlCommand cmd = new SqlCommand(insertQuery, conn); conn.Open(); int RecordsAffected = cmd.ExecuteNonQuery(); conn.Close();