Questions tagged [datarow]

DataRow is an ADO.Net class that represents a row of a data in a DataTable.

755 questions
4
votes
2 answers

Adding Datarow between Rows?

how can i add rows between existing rows in a datatable ? Thanks
subprime
  • 1,217
  • 8
  • 20
  • 34
4
votes
2 answers

Add Columns to new DataRow

Is it possible to create a new DataRow object and add columns to it at runtime? // How can I specify column names for this data row object? DataRow row = new DataRow();
KodeKreachor
  • 8,852
  • 10
  • 47
  • 64
3
votes
6 answers

compare datarows of different tables

I posted a similar query some time ago and decided to trim down the complexity of it to let developers answer my main problem. It could be stated as duplicate, but still I want to post it as editing the previous post did not yield much result. I…
Sandy
  • 11,332
  • 27
  • 76
  • 122
3
votes
1 answer

Databinding for checkbox with stringvalues

I have to bind datarows to my controls. So far so good. The problem now is, that my datarow contains only strings in the column I have to bind, but of course the property "checked" of a Checkbox takes only boolean arguments. Is there a way to use…
lostiniceland
  • 3,729
  • 6
  • 38
  • 50
3
votes
3 answers

How to modify the List view column?

I have list view the data will be displayed in list view from data table like this i have done but i have problem at datarow 6 dt = classes.xxxxx.GetData(sql, mf); if (dt != null) { ListViewItem newitem = null; …
user682417
  • 1,478
  • 4
  • 25
  • 46
3
votes
3 answers

How to find max value in a column in a datarow[] ?

I have a simple problem but I just don't understand any of the examples I find here or in MSDN. (I'm still new to C# and all the datasets functions). I have a datatable "tblRoom" which its columms are "building","apartment" and "room" and they're…
Shay Krainer
  • 35
  • 1
  • 1
  • 5
3
votes
4 answers

DataGrid to DataRowView

I need charged the item value from a dataGrid when user click on, into a datarowview to take the first value "IdEmployee" and assign to a variable. This is my method, the problem is my variable dataRowView is Null! How can I fix this? private void…
ale
  • 3,301
  • 10
  • 40
  • 48
3
votes
3 answers

DataRow comparison not working as expected

I'm trying to compare two DataRows in a loop. However, the following if statement doesn't return true: if (dt1.Rows[0]["Name"] == dt2.Rows[b]["Name"]) { // This never executes } However, if I add .ToString() to the end of each DataRow, the if…
GateKiller
  • 74,180
  • 73
  • 171
  • 204
3
votes
3 answers

VB.Net Datatable Select MID function

I'm trying to extract all rows from a datatable where "CODE" follows the pattern "Z##A". I tried the following to no avail: Dim floods() As DataRow = arqTable.Select("mid(code,1,1)='Z' and isnumeric(mid(code,2,2)) and mid(code,4,1)='A'") An error…
DontFretBrett
  • 1,135
  • 3
  • 17
  • 32
3
votes
3 answers

mono c#. DataRow: "Field" extension method missing?

I've often used the DataRow object (or DataRowCollection) when programming C# in Windows (.NET Framework 3 and 3.5). Now, I want to use it in a C# program developed with mono in Linux. My problem is: I don't find the "Field" extension method of…
niColas
  • 31
  • 1
  • 4
3
votes
1 answer

How to get the primary key column from a data row?

In my code there is a data row. Is there a way to get the primary key from this or no? My code is: var PK = data_row.PrimaryKey; However, this I looked up in the MS docs and there is no PrimaryKey property if a data row, there is a property like…
user10171440
3
votes
3 answers

In a timeseries of column values - how can i use previous available value if row value is null. c# (Datatable/Datarow)

I'm reading Datatable column values into an array but my current code skips null values. Question - How can I achieve the following within the code listed below - If null value then read the previous available value in the time series. **For example…
war10ck
  • 103
  • 1
  • 1
  • 8
3
votes
3 answers

C# Adding rows to a DataTable inside a foreach loop

I'm trying to add variables from a text file into a datatable to be converted into a CSV file but I keep getting this error: "A column named 'Machine Number' already belongs to this DataTable" Im not sure what to do, any help would be appreciated,…
Mark Buckley
  • 75
  • 1
  • 1
  • 7
3
votes
4 answers

Link in a DataRow (Datatable)

I'm building a DataTable dynamically and I'm trying to add a "link" in the DataRow(s) that I'm adding to the DataTable. The DataTable is bound to a GridView after it's creation. Something like that : DataTable dataTable = new DataTable(); …
tink01
  • 94
  • 1
  • 2
  • 5
3
votes
2 answers

Generic DataRow extension

I use a extension method to check a DataRowField for null public static string GetValue(this System.Data.DataRow Row, string Column) { if (Row[Column] == DBNull.Value) { return null; } else { return…
Toshi
  • 2,532
  • 4
  • 17
  • 45