I am using VS2005 for vb.net. I am getting compile error at below statement. How to fix this?
For Each rw As DataRow In data.Rows
For Each dc As DataColumn In stringColumns
rw.Field(Of String)(dc).Replace("_x00D_", "") //Error showing here
Next
Next
DataRow Field. Summary. We used DataRow in C# programs. This is a powerful collection in System.Data that will greatly help your program and keep its code understandable. The DataRow is used in almost every program that also uses the DataTable type.
Use the DataRow object and its properties and methods to retrieve and evaluate; and insert, delete, and update the values in the DataTable. The DataRowCollection represents the actual DataRow objects in the DataTable, and the DataColumnCollection contains the DataColumn objects that describe the schema of the DataTable.
Every DataRow will contain cells or fields. You will often need to examine these values while using DataTables in memory. Here we access the ItemArray on a DataRow, and then test each field in that row. Note: You can avoid casting with the Field generic method. Please see the section further down for more info.
System.Data.DataRow' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'System.Data.DataRow' could be found (are you missing a using directive or an assembly reference?) I referenced System.Data Version 4 in both projects. What am I missing here? Note: ItemArray exists in both...
Add a reference to System.Data.DataSetExtensions.dll
then your code will work. Field
is a Extension method you need to add the reference otherwise it will not work.
VS 2005 with .net 2.0 ?
then you can't add reference to this dll. you need to target .net 3.5 or above to use these extension methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With