Enrique
Enrique

Reputation: 153

Query to AS400 from a dataset

I have a dataset and my question is how can I read a specific value and set in a query to delete.

For example the query I would send to the AS400:

delete from xxx.yyy where data1 = dataset.tables[0].value

How can I achieve this?

Upvotes: 0

Views: 293

Answers (1)

Kevin LaBranche
Kevin LaBranche

Reputation: 21078

Your example is close. You are grabbing the first table but not the row & then column value in that row. You can do this several ways.

Here's a few samples:

datasetname.tables[0].Rows[0].Item(0) 

datasetname.tables[0].Rows[0].Item("ColumnName") 

datasetname.tables[0].Rows[0][0] 

datasetname.tables[0].Rows[0]["ColumnName"]

Depending on what you are setting against you might need to convert/cast or use the ToString on your value.

Upvotes: 2

Related Questions