Hi, I need to update the database (access db) after performing certain task.
previously I use to update the table based on key1, everything was working fine.
Update Table set value1=@value1,value2=@value2 WHERE key1=@key1
Now I’m using key2 to update the table, there are no errors thrown by UiPath - but the table is not updating.
Update Table set value1=@value1,value2=@value2 WHERE key2=@key2
Did you check if there are rows that are actually getting affected for the given query?
in the output - AffectedRecords - can you check what is the output you are getting here? is it 0 ?
Yes, It’s 0.
I can see that key2 is present in the table. But it’s not updating.
Also key1 was just 10 characters and key2 is 44 characters. Does long length of these keys may give issues?
in the parameter, what is the data type have you given ? can you put a message box and see what is the value you are getting in @key2 before passing it to the activity?
yes , 44 characters could be a problem if you are not using the correct data type.
can you change the data type as string and try if it is not string already?
Foe executing update query…you should be using run command/execute non query activities…
Execute query /run query is for select statement… for all dml statement like update,insert ,delete we have to use run command activity
Yes, the value I’m getting is matching with the key2 value in database. Also it’s already a string.
While passing the value in parameter, I even tried it as key2 = key2value.ToString. But still it’s not updating.
I’m using Execute non-query, still having this issue.
can you try passing the value in the query itself like below?
“Update Table set value1=”+value1+“,value2=”+value2+“WHERE key2=”+key2
Unfortunately I can’t do that, as key2 will be generated in the process. Like key2 = value+Time and it’ll added to the table at initial stage. Later I have to update the result to the same row.
Did you run the update query in sql command line?
Can you check if the key is matching with what you are passing by executing the query
And i believe the format of update query if you have strings…then we need to enclose them in single quotes…
Can you try please
Can you provide a example value of Key2 ?
I have faced a similar issue when i had a combination of string+Time with no formatting applied to the time , lets say for example - asdfhgjkl11:30:12 , this didnt work. I formatted the key to asdfhgjk113012
Sorry for the late reply, was sick.
The Key2 - 410765720230113091442882. Interestingly, Update only working on only Key1, other than that, it’s not working on none of the columns.
Can you try to update a record by hardcoding the query in UiPath and see if you are able to make an update?
Sure. I’ll try that and will update.