Conteúdo do Curso
Introduction to .NET with C#
2. Asynchronous Programming and Introduction to Web Services
3. Introduction to Databases with .NET
Introduction to .NET with C#
Task - 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.
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
}
}
Tudo estava claro?
Conteúdo do Curso
Introduction to .NET with C#
2. Asynchronous Programming and Introduction to Web Services
3. Introduction to Databases with .NET
Introduction to .NET with C#
Task - 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.
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
}
}
Tudo estava claro?