Can you update changes from a datatable to the mysql database using join?

my query is

select Item_Name as 'Product', Size, Price, Quantity, CategoryName as 'Category' from items inner join size on items.ItemID=size.ItemID inner join category on items.CategoryID=category.CategoryID; 

and my codes for getting it is

public static DataTable GetCustomTable(string query,string tableName) { connection.Open(); var dadapt = CreateDataAddapter(query); var dt = new DataTable(tableName); dadapt.Fill(dt); connection.Close(); return dt; } 

will this code still work?

 var query = CreateSelectStatement(tableName.ToString()); var dadapt = CreateDataAddapter(query); var comBuild = new MySqlCommandBuilder(dadapt); dadapt.Update(databaseRecord.Tables[tableName.ToString()]); 

or do I have to change each table?

by jpfrost via /r/csharp

Leave a Reply