Reputation: 5349
Rather than referencing 0
and 1
for my rows. How do I reference the name of the columns in my data table?
txtCustomerRef.Text = dobj.GetCustomerData(selectedValue).Rows[0][0].ToString();
txtCustomerName.Text = dobj.GetCustomerData(selectedValue).Rows[1][1].ToString();
Upvotes: 1
Views: 50
Reputation: 754388
Just use the column name for your columns:
txtCustomerRef.Text = dobj.GetCustomerData(selectedValue).Rows[0]["CustomerRef"].ToString();
txtCustomerName.Text = dobj.GetCustomerData(selectedValue).Rows[1]["CustomerName"].ToString();
Upvotes: 2