poobalan
poobalan

Reputation: 11

Dynamically passing column name in ADO.NET

string[] rowdetails = orderDS.Tables[0].Rows[j]["'"+column[k]+"'"] as string[];

Can a column name can be passed dynamically? The code above is not working when I pass the column name. Double quotes is the problem. I need to pass the column name there.

Upvotes: 1

Views: 223

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

DataRow has multiple Item properties that you could use:

string[] rowdetails = orderDS.Tables[0].Rows[j][column[k]] as string[];

Upvotes: 3

Related Questions