im trying to update my db doing:
int index = grdExcUsePolicy.EditIndex;
GridViewRow row = grdExcUsePolicy.Rows[index];
string id = ((Label)row.FindControl("lblId")).Text;
String name = ((TextBox)row.FindControl("txtName")).Text;
String created = ((TextBox)row.FindControl("txtCreated")).Text;
if (gridUtil.getInsertMode())
{
}
else
{
GeneralDbExecuterService.executeSqlNonQuery(string.Format("UPDATE EXCEPTIONAL_USE_POLICY_PARAM
SET NAME = '{0}', CREATED_DATE = to_date('{2}', 'dd/mm/yyyy') WHERE ID = '{1}' ", name, id,
created));
}
inside sql everything updates perfectly., and when performing the following code I can either update only date or both name+date together, but I get an error trying to update name alone??..
also I checked and name isnt any kind of key.
I basically have other tables and gridview that work fine, every column individually. I just copy paste it and change variables to the current table’s needs. why am I getting the error?
important to add that my aspx. and aspx cs both copied and changed so code behind is the same, but still only here the eror Im getting
2
Answers
If you do db update database from the control section, it will be fixed.
I fixed it, but the problem wasn’t related to anything other than the reason somewhy when I tried to update the name alone the DB query pulled me a date with time, and when I tried to change only the date it was giving me just a date. so basically a collision between the correct format of the date.
before
after