Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataView.Item property
Message
De
17/01/2005 10:47:37
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00977752
Message ID:
00977754
Vues:
32
Einar,

There's lots of differences in stuff between VB and C#. You should use this syntax for a DataView in C#:
	return dv[0]["OptionValue"];
That should work.

~~Bonnie



>I have some problems getting the following code to compile:
>
>DataView dv = dsOptions.Tables["ConfigValues"].DefaultView;
>dv.RowFilter = "OptionName='" + paraOptionName + "'";
>
>if (dv.Count > 0)
>{
>	return dv.Item[0].Item("OptionValue");
>}
>else
>{
>	return "";
>}
>
>
>I receive the following error:
>
>'System.Data.DataView' does not contain a definition for 'Item'
>
>
>This code is "borrowed" from an article from CodeProject and was originally VB.NET. This is the original code (only problematic code listed):
>
>Return CStr(dv.Item(0).Item("OptionValue"))
>
>
>I did some searchine and the M$ docs tells me that there is an item property for the DataView class, but intellisense does not reveil if for me. I think I have used the correct syntax when translating from VB.NEt to C#.
>
>If anyone could let me know what is wrong that would be great.
>
>Thanks,
>Einar
Bonnie Berent DeWitt
NET/C# MVP since 2003

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

Click here to load this message in the networking platform