Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Task - Using UPDATE | CRUD Operations with MySQL
course content

Зміст курсу

Introduction to .NET with C#

Task - Using UPDATETask - Using UPDATE

Some new stock has arrived. The store owner tells you to set the quantity of all the products to 200, which was previously less than 100.

Your task is to update the quantity of all the products to 200, which is less than 100 in terms of quantity.

Link to the Task: GitHub
Use the UPDATE statement with the condition WHERE stock_quantity < 100.

using MySql.Data.MySqlClient;

public class CRUD_Task_4
{
    // Write the connection string here
    public static string connectionString = "server=___;port=___;user=___;password=___;database=___";

    static void Main(string[] args)
    {
        // Write code below this line
        using (MySqlConnection connection = new MySqlConnection(connectionString))
        {
            connection.Open();

            string cmdText = "UPDATE store SET stock_quantity = 200 WHERE stock_quantity < 100";
            MySqlCommand cmd = new MySqlCommand(cmdText, connection);
            cmd.ExecuteNonQuery();
        }
        // Write code above this line
    }
}    
  

Все було зрозуміло?

Секція 4. Розділ 10
course content

Зміст курсу

Introduction to .NET with C#

Task - Using UPDATETask - Using UPDATE

Some new stock has arrived. The store owner tells you to set the quantity of all the products to 200, which was previously less than 100.

Your task is to update the quantity of all the products to 200, which is less than 100 in terms of quantity.

Link to the Task: GitHub
Use the UPDATE statement with the condition WHERE stock_quantity < 100.

using MySql.Data.MySqlClient;

public class CRUD_Task_4
{
    // Write the connection string here
    public static string connectionString = "server=___;port=___;user=___;password=___;database=___";

    static void Main(string[] args)
    {
        // Write code below this line
        using (MySqlConnection connection = new MySqlConnection(connectionString))
        {
            connection.Open();

            string cmdText = "UPDATE store SET stock_quantity = 200 WHERE stock_quantity < 100";
            MySqlCommand cmd = new MySqlCommand(cmdText, connection);
            cmd.ExecuteNonQuery();
        }
        // Write code above this line
    }
}    
  

Все було зрозуміло?

Секція 4. Розділ 10
some-alt