更新mysql数据库DDT-groupname

本文关键字:DDT-groupname 数据库 mysql 更新 | 更新日期: 2023-09-27 18:17:00

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();        

更新mysql数据库DDT-groupname

        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 { }
    }