how do you get a value...

  • Thread starter Thread starter Lerp
  • Start date Start date
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
 
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
 
Back
Top