protected void AddTransaction(object sender, EventArgs e)
{
SqlConnection conAddTransaction = new SqlConnection(ConfigurationManager.ConnectionStrings["connMSJ"].ConnectionString);
SqlCommand cmdAddTransaction = new SqlCommand("UPDATE DailyBudget SET @category=@amount WHERE Username=@username", conAddTransaction);
cmdAddTransaction.Parameters.AddWithValue("@category", "Foods");
cmdAddTransaction.Parameters.AddWithValue("@amount", Convert.ToDouble("200"));
cmdAddTransaction.Parameters.AddWithValue("@username", "mhingshiang");
conAddTransaction.Open();
cmdAddTransaction.ExecuteNonQuery();
conAddTransaction.Close();
}
The Foods
is one of the column name in DailyBudget
table.
But it can't update to the table while i testing some dummy values.