I have a small problem according to data set values, I want to subtract those values and save it a new variable column, this is my code:
StrSQL = "Select * from Stocks";
rs = (DataSet) MethodClass.ConnectionToQuery(StrSQL);
for (i = 0; i < rs.Tables[0].Rows.Count; i++)
{
StrSQL = " Update Stocks Set ";
// Error is in below line
StrSQL = StrSQL + " Balance = '" + (rs.Tables[0].Rows[i]["RQty"]) - (rs.Tables[0].Rows[i]["IQty"]) + "'";
StrSQL = StrSQL + " Where ProductCode = '" + rs.Tables[0].Rows[i]["ProductCode"] + "'";
MethodClass.ConnectionToQueryCommand(StrSQL, "ExecuteNonQuery");
}
Error is:
Operator '-' cannot be applied to operands of type 'string' and 'object'
Aucun commentaire:
Enregistrer un commentaire