how to update sql table from another table using core mvc 5

Last Reply 7 days ago By dharmendr

Posted 8 days ago

I have two table, one table name A contains data for code, city name and country name. I have form where user will provide the details based on zip code I need to update the table B with city name and country autometically in form.

You are viewing reply posted by: dharmendr 7 days ago.
Posted 7 days ago

Hi damodave,

You can use SQL query to update the record. Create procedure of the query and call the procedure in your ASP.Net core application which will update your tableB.

SET tableB.CityName = tableA.CityName,
	tableB.Country = tableA.Country 
FROM tableA
INNER JOIN tableB ON tableB.Id = tableA.Id
WHERE tableB.ZipCode = '123456'

Note: You need to change the query as per your table schema.

I agree, here is the link: