I have a button that's supposed to run a SQL query.
<button class="btn btn-info mt-3"asp-controller="MessageCenter" asp-action="Markmessage">Mark</button>
there is no forms or any sort of thing that I can use a post method
for. here is the function that I'm trying to call(this is in my controller by the way).
public void Markmessage()
{
Messagelookupinfo messagelookup = new Messagelookupinfo();
SqlConnection sql = new SqlConnection();
SqlConnection sqlcon = new SqlConnection("data source");
sqlcon.Open();
SqlCommand sqlcom = new SqlCommand("update messages set messagestatus='MARKED' where messageid=" + messagelookup.Messageid, sqlcon);
sqlcom.ExecuteNonQuery();
sqlcon.Close();
RedirectToAction("Messagelookup", "Messageid=" + messagelookup.Messageid);
}
There is no feedback/confirmation for the user just straight up run the query and reload the page.
How do I achieve this?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…