MySqlConnection conn = new MySqlConnection("server=localhost;uid=root;" + "pwd=password;database=ddt_data");
conn.Open();
string command = "Update `fixture` SET `referee`=@referee, `ScoreA`=@ScoreA, `ScoreB`=@ScoreB, `Winner`=@Winner WHERE idfixture=" + Request.QueryString["idfixture"];
MySqlCommand update = new MySqlCommand(command, conn);
update.Parameters.AddWithValue("@referee", this.txtRef.Text);
update.Parameters.AddWithValue("@scorea", this.txtScoreA.Text);
update.Parameters.AddWithValue("@scoreb", this.txtScoreB.Text);
update.Parameters.AddWithValue("@winner", this.txtWinner.Text);
update.ExecuteNonQuery(); // use this if you don't need the DataReader
conn.Close();
conn.Dispose();
答案 0 :(得分:0)
MySqlConnection conn = new MySqlConnection("server=localhost;uid=root;" + "pwd=password;database=ddt_data");
conn.Open();
try
{
string command = "Update fixture SET referee =@referee," + "ScoreA = @ScoreA, ScoreB = @ScoreB, Winner = @Winner " + "WHERE idfixture= " + Request.QueryString["idfixture"];
MySqlCommand update = new MySqlCommand(command, conn);
update.Parameters.AddWithValue("@referee", this.txtRef.Text);
update.Parameters.AddWithValue("@scorea", this.txtScoreA.Text);
update.Parameters.AddWithValue("@scoreb", this.txtScoreB.Text);
update.Parameters.AddWithValue("@winner", this.txtWinner.Text);
update.ExecuteNonQuery(); // use this if you don't need the DataReader
conn.Close();
conn.Dispose();
}
catch { }
}