Displaying field value in datarow

A

Amos

I'm trying to display a field from a datarow like this:

DataRow[] myRow = DS_Urb.Tables["Urb"].Select("Code = 'MyCode'"); // it
returns at least one row
MessageBox.Show (myRow[0].ToString(), urb);


But I get "System.Data.DataRow". How can I display field "Name" ?
 
M

Mohamoss

hi Amos!
you are just refering to the row here ,
MessageBox.Show (myRow[0].ToString(), urb);
you need to refere to the name field
MessageBox.Show (myRow[0]["name"].ToString(), urb);

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top