Hi,

I have a datarow retrieved from a datatable. I have a value that exists in some column in the datarow. I want to find which column this value is in. How can I achieve this please?

Thanks

More information needed about your scenario. What are you using to do the value testing?

If you just want to use SQL, then you have to do something clunky like using a CASE statement that tests each column against the desired value. If you are using some data access method like ADO from within a program, then you can iterate through the Fields collection to find the value you're looking for, then get the Field(x).Name value for the column name.

Not sure if that's what you're looking for, but I hope it gives you some ideas. Good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.