how do you get a value...

L

Lerp

hi,

How do you get a value, say a clientname, from a CLIENT table in a dataset
based on the clientid value in another table called ORDER through a data
relation called 'mydatarelation'? A CLIENT may have one or more ORDERS.

I have not been able to find any examples on this, can anybody help?


Cheers, Lerp
 
W

William F. Robertson, Jr.

This is some hacky code, but I am not sure exactly what you are wanting.

DataSet ds = //DataSet
DataTable tblClient = ds.Tables["ClientTable"];

//pull the clientid that you want to look up.
string clientID = GetClientID();

//You can do a select on the table to get the DataRows.
//it will return an array of DataRows that have the clientID equal to the
clientID.
DataRow [] rows = tblClient.Select( "clientID = " + clientID );

//also if the ClientID column is the PrimaryKey column for tblClients
DataRow row = tblClient.Rows.Find( clientID );

bill
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top