# UpdateCommand.Parameters have wrong value in ADO.NET Provider for Presto

**URL:** <https://community.cdata.com/t/updatecommand-parameters-have-wrong-value-in-ado-net-provider-for-presto/540>\
**Category:** CData Drivers\
**Tags:** question, ado.net\
**Created:** [November 28, 2023, 8:17pm UTC](https://community.cdata.com/t/updatecommand-parameters-have-wrong-value-in-ado-net-provider-for-presto/540 "2023-11-28T20:17:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rocketmaniac](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rocketmaniac](https://community.cdata.com/u/rocketmaniac)\
**Post date:** [November 28, 2023, 8:17pm UTC](https://community.cdata.com/t/updatecommand-parameters-have-wrong-value-in-ado-net-provider-for-presto/540/1 "2023-11-28T20:17:09Z")

</div>

Following the example code for Update, we have this against one of our Hive transactional datastores:

```csharp
 PrestoDataAdapter dataAdapter = new PrestoDataAdapter("SELECT _id, name FROM hive.transactional_schema.[TableName]", connection); dataAdapter.UpdateCommand = new PrestoCommand( "UPDATE hive.transactional_schema.[TableName] SET name = @name " + "WHERE _id = @_id", connection); dataAdapter.UpdateCommand.Parameters.Add(new PrestoParameter("@name", "name", DbType.String)); dataAdapter.UpdateCommand.Parameters.Add(new PrestoParameter("@_id", "_id", DbType.String)); dataAdapter.UpdateCommand.Parameters[1].SourceVersion = DataRowVersion.Original; DataTable table = new DataTable(); dataAdapter.Fill(table); DataRow firstrow = table.Rows[0]; firstrow["name"] = firstrow["name"] + "-Updated"; dataAdapter.Update(table);

```

firstrow shows the updated name property, but the query that gets sent to Trino is:

```sql
UPDATE "hive"."transactional_schema".[TableName] SET "name" = 'name' WHERE "_id" = '_id'

```

so I guess I don’t understand how PrestoParameter is meant to work…from the example it looked like it was meant to map the property value (e.g. “name-Updated”) to the query parameter (e.g. @name), but it looks like it’s just passing in the 2nd param of PrestoParameter (e.g. “name”) as the value in the query.

---

<div class="post-metadata">

**Author:** ![Luçjano\_Capo](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/lu%C3%A7jano_capo/32/1638_2.png) [@Luçjano\_Capo](https://community.cdata.com/u/Lu%C3%A7jano_Capo)\
**Post date:** [December 1, 2023, 11:05am UTC](https://community.cdata.com/t/updatecommand-parameters-have-wrong-value-in-ado-net-provider-for-presto/540/2 "2023-12-01T11:05:20Z")

</div>

Hi @rocketmaniac ,

Thank you for reaching out.

Our development team is already aware of this issue and actively working on a fix.

I’ll make sure to update you as soon as there are any developments, and we anticipate resolving this shortly.

---

<div class="post-metadata">

**Author:** ![Luçjano\_Capo](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/lu%C3%A7jano_capo/32/1638_2.png) [@Luçjano\_Capo](https://community.cdata.com/u/Lu%C3%A7jano_Capo)\
**Post date:** [December 8, 2023, 9:55am UTC](https://community.cdata.com/t/updatecommand-parameters-have-wrong-value-in-ado-net-provider-for-presto/540/3 "2023-12-08T09:55:20Z")

</div>

Hi @rocketmaniac ,

After discussing this case with the development team, we concluded that there has been a documentation bug with this procedure:

```csharp
dataAdapter.UpdateCommand.Parameters.Add(new PrestoParameter("@name", "name", DbType.String));

```

This is one of the ways we can call a new Presto Parameter, using these arguments →&nbsp;the name of the variable, a value for that variable and the data type. This method allows you to set a value directly to your variable and this defies the purpose of changing the value in this next part:

```csharp
firstrow["name"] = firstrow["name"] + "-Updated";

```

Another way we can call a new Presto Parameter is this way:

```csharp
dataAdapter.UpdateCommand.Parameters.Add(new PrestoParameter("@name", DbType.String, "name"));

```

Using these parameters →&nbsp;the name of the variable, the data type and **the source column**. This way, you will map the source column and will be able to change the value below.

Please try this method and let me know how it goes.

---

<div class="post-metadata">

**Author:** ![rocketmaniac](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rocketmaniac](https://community.cdata.com/u/rocketmaniac)\
**Post date:** [December 8, 2023, 5:55pm UTC](https://community.cdata.com/t/updatecommand-parameters-have-wrong-value-in-ado-net-provider-for-presto/540/4 "2023-12-08T17:55:57Z")

</div>

That worked…thanks to you and the team for looking into this,&nbsp;[Luçjano](https://community.cdata.com/members/lucjano-capo-437)!

---

<div class="post-metadata">

**Author:** ![Luçjano\_Capo](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/lu%C3%A7jano_capo/32/1638_2.png) [@Luçjano\_Capo](https://community.cdata.com/u/Lu%C3%A7jano_Capo)\
**Post date:** [December 11, 2023, 9:31am UTC](https://community.cdata.com/t/updatecommand-parameters-have-wrong-value-in-ado-net-provider-for-presto/540/5 "2023-12-11T09:31:54Z")

</div>

I am glad I was able to help @rocketmaniac !
