Hi,
1. Build query string from variables i.e:
string strStringParameter = "example";
int nIntegerParameter = 10;
string strQuery = "UPDATE TableName SET " +
"Column1 = '" + SafeFromInjection(strStringParameter) + "', "
"'Column2 = " + nIntegerParameter.ToString() + " WHERE Column1 = 1;"
2. (Preffered) Use Parameters
string strStringParameter = "example";
int nIntegerParameter = 10;
string strQuery = "UPDATE TableName SET " +
"Column1 = @StringParameter, "
"Column2 = @IntegerParameter;"
MySqlCommand oCommand = new MySqlCommand(strQuery, oConnection);
MySqlParameter oParameter;
oCommand.CommandText = strQuery;
oParameter = new MySqlParameter("@StringParameter", MySqlType.VarChar);
oParameter.Value = strStringParameter;
oCommand.Parameters.Add(oParameter);
oParameter = new MySqlParameter("@IntegerParameter", MySqlType.Int);
oParameter.Value = nIntegerParameter;
oCommand.Parameters.Add(oParameter);
oCommand.ExecuteNonQuery();
sorry, i wrote it without checking and compiling. note 2nd example is for
managed mysql provider, you can use it in the same way for OLEDB.
Hope this helps