OleDbCommand1.CommandText = "UPDATE data Set [pivot] =@pivot WHERE [ID] = @id"; for (int i = 0; i < n; i++) { float OP =float.Parse(dt.Rows[i]["openPrice"].ToString()); float CP = float.Parse(dt.Rows[i]["closePrice"].ToString()); float HP = float.Parse(dt.Rows[i]["highPrice"].ToString()); pivotValue = (OP + CP + HP) / 3; pivotValueString = pivotValue.ToString(); OleDbCommand1.Parameters.AddWithValue("@pivot", pivotValueString); OleDbCommand1.Parameters.AddWithValue("@id", int.Parse(dt.Rows[i]["ID"].ToString())); // OleDbCommand1.CommandText = "UPDATE data Set [pivot] =@pivot WHERE [ID] = @id"; OleDbCommand1.ExecuteNonQuery(); }
OleDbCommand1.Parameters.Clear(); OleDbCommand1.Parameters.AddWithValue("@pivot", pivotValueString); OleDbCommand1.Parameters.AddWithValue("@id", int.Parse(dt.Rows[i]["ID"].ToString()));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)