Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Seeking DataSet
Message
De
13/02/2003 20:52:50
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Divers
Thread ID:
00749790
Message ID:
00753032
Vues:
37
Ahmad,

You could write your own find method, something like this (untested code):
public DataRow MyFind(DataTable MyTable, string ColumnName, object ColumnValue)
{
  for (int i=0; i < MyTable.Rows.Count; i++)
  {
    if (MyTable.Columns.Contains(ColumnName) && MyTable.Rows[i][ColumnName] == ColumnValue)
      return MyTable.Rows[i];
  }
  // if none found, return a blank row.
  return new DataRow();
}
~~Bonnie



>Hi Jayesh,
>
>Regarding the Find() method, I works only with PK's, what if I want to search for some data in not a PK column, .Find will not work...
>
>Select statment with Where clause is only the choise ??
>
>
>
>
>>DataRowCollection has Find() method. You can do something like this:
>>
>>
myDataSet.Tables[myTable].Rows.Find(CustomerId);
>>
>>>Dear All,
>>>
>>>Is there a way to seek the DataSet (ADO.NET) like old ADO?
>>>if not how to find records, is't by using sql commands only?
>>>
>>>Thanks for the help
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform