My table Student has 4 columns ID, Name, FamilyName and Age.
I ask user to give specific ID and then one of the columns to update with query.
My update query CommandText is as follows:
public void Update (OleDbConnection connection, string Name, int ID)
{
_command.Connection = connection;
_command.CommandText = String.Format("UPDATE Student SET Name = Name WHERE ID = ID");
_command.ExecuteNonQuery();
}
In main() by the use of a switch I am trying to manage which column the user wants to update. like this:
Console.WriteLine("which do you want to edit, name, family name or age?");
var answer2 = Console.ReadLine().Trim().ToLower();
switch(answer2)
{
case "name":
My question is: in my query in CommandText, is it possible to write
UPDATE Student
SET Name = Name || FamilyName = Name || Age = Name
WHERE ID = ID