Consultar a AS400 desde un conjunto de datos

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

¿Cómo puedo conseguir esto?

preguntado el 08 de noviembre de 11 a las 19:11

1 Respuestas

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.

respondido 09 nov., 11:00

Cool thanks for the help, sadly I can't use a store procedure this time. - Enrique

@Enrique - What do you mean you can't use a stored procedure? The above code is using a dataset as explained in your question? - Kevin LaBranche

Oh I mean it would be easier to solve it with a sp, but for this program in specific I can't use them. Your solution is perfect, sorry to confuse you. - Enrique

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.