Exemplo n.º 1
0
        public ChangeCustomerOrder(int id_order, CustomerOrders form)
        {
            prev_form = form;
            id        = id_order;
            InitializeComponent();
            string connectionString = @"Data Source=LAPTOP-96NT0MPR;Initial Catalog=kursach;Integrated Security=True";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand();
                command.Connection = connection;
                string        sqlExpression = "SELECT * FROM Заказы WHERE Код_заказа = " + id;
                SqlCommand    commandread   = new SqlCommand(sqlExpression, connection);
                SqlDataReader reader        = commandread.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    CommentBox.Text = reader.GetString(4);
                }
            }
        }