Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scan in ADO?
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Divers
Thread ID:
00943893
Message ID:
00943898
Vues:
20
Thanks, That should do it. I also just realized I can't use an int where a DataRow is expected like I would when referencing a collection subscript reference.

>Hi, Eric,
>
>First, here is a link that covers part of what you're asking. Some of this you may already know, but there's some good info that might help out...
>
>http://www.c-sharpcorner.com/Code/2004/March/DataSetsIn.NETP2.asp
>
>
>Second, to do the equivalent of a SEEK, you first need to define a primary key for the datatable, then you can perform an ADO.NET FIND, like so...
>
>
>MyTable.PrimaryKey = new DataColumn[] {MyTable.Columns["MyColumn"]};
>DataRow Dr = MyTable.Rows.Find("valuetosearch");
>if(Dr!=null) {
>   // run your code based on the hit
>
>
>You can also create a primary key with multiple columns. Note that the primary key you define MUST be unique. If not, you'll get an error message.
>
>Finally, as for scanning through rows, there are a couple of ways, here's what I usually do...
>
>
>foreach(DataRow DrDetail in MyTable.Rows)
>   MessageBox.Show("Value of invoice id is " + DrDetail["invoiceid"].ToString());
>
>
>Now...if you're scanning through a dataview associated with a rowfilter, you might want to do something like this...
>
>
>MyTable.DefaultView.RowFilter = " paid = true ";
>foreach(DataRow drv in MyTable.DefaultView)
>   \\ code for drv
>
>
>The on-line help has some additional code examples, if you search on the keywords "primary key", "rowfilter", "find", etc.
>
>Hope that helps...
>Kevin
Eric Kleeman - EDS Consulting Services
MCP Visual FoxPro
MCSD C#.NET
Hua Hin Thailand
Los Angeles California
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform