我有一个语句插入到我的数据库中,但插入后我想更新表中的数据webservice
。我要怎么做?
这是我插入数据的代码:
[WebMethod]
public static void InsertStudentTransaction(string Name, string CLass, string NRIC, int StallNo, float AmountSpent, DateTime GetDate)
{
using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString))
{
SqlCommand command = new SqlCommand("INSERT Into StudentTransactions (Name, CLass,NRIC,StallNo,AmountSpent, TimeDate) VALUES (@Name, @CLass, @NRIC, @StallNo, @AmountSpent, @GetDate)");
command.Parameters.AddWithValue("@Name", "Name");
command.Parameters.AddWithValue("@CLass", "CLass");
command.Parameters.AddWithValue("@NRIC", "NRIC");
command.Parameters.AddWithValue("@StallNo","StallNo");
command.Parameters.AddWithValue("@AmountSpent", "AmountSpent");
command.Parameters.AddWithValue("@TimeDate", "GetDate");
command.Connection.Open();
command.ExecuteNonQuery();
}