756 questions
0
votes
2
answers
584
views
C# LINQ Dynamic - Against a DataTable - Syntax not working?
My app allows the user to choose what table and columns to filter on. It can be a different table and columns each time the user runs this routine. So standard LINQ will not work. I need to do this ...
-1
votes
3
answers
106
views
Sum of multiple datatable columns
I want to get the sum of only two columns for each data row in datable and display it in datagridView. I tried to use link query:
SqlCommand cmd = new SqlCommand("SELECT * FROM Student", con)...
0
votes
0
answers
58
views
Unable to Navigate to URL from Excel DataRow in Power Automate Desktop
I'm currently working on a flow using Power Automate Desktop, and I'm encountering an issue accessing a URL from an Excel DataRow.
Here's the scenario. I've successfully read data from an Excel ...
5
votes
1
answer
685
views
Tests with DataRow-attribute not executed with new mstest & sdk-package
I am using Visual Studion 17.12.5 and I am experiencing the following problem.
After upgrading the MSTest-package from 3.7.3 to 3.8.0 and Microsoft.NET.Test.Sdk from 17.12.0 to 17.13.0 the most of my ...
1
vote
1
answer
66
views
How to set datagridview and datarow cell format when editing and after editing from datatable in vb.net
I'm Trying to set datagridview and datarow cell format when editing and after editing from datatable in vb.net.
Is it possible for the Price column to still use string.empty after editing so it ...
0
votes
1
answer
367
views
Adding rows to a DataSet (C#)
I have a DataSet in C# composed from three tables, with columns only, and I am trying to populate these tables by adding rows.
This is my first table (destinationTable)
The two columns that I am ...
1
vote
0
answers
50
views
Get data from related tables in SQL database using vb.net DataRow class [duplicate]
I have relational tables like this
Orders: (id, customerId(FK), productId(FK), date)
Customers: (id(PK), name, surname)
Products: (id(PK), name, price)
in Orders table, customerId and productId have ...
0
votes
0
answers
32
views
TestContext.DataRow is not supported [duplicate]
I am trying to convert a code from an old version of C# to a new one. Here is a minimal example:
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Example
{
class Program
{
static void ...
-1
votes
1
answer
401
views
Cannot Perform '-' operation on System.String and System.Decimal on DataTable.Select statement
I am trying to execute this select statement within my application and encounter the System.Data.EvaluateException "Cannot perform '-' operation on System.String and System.Decimal"
foreach (...
0
votes
1
answer
44
views
How to get dataset items properly written to XML file
I have managed to get my program running as I would like it to. The issue I am running into is when I write to an XML file. I feel like I have everything set up correctly to write the contents of ...
0
votes
0
answers
347
views
Out Of Memory Exception - Loading Datatable
I am trying to create a datatable and load a single row in to the datatable. I am using this datatable as table type parameter. But this method is enclosed in a ParallelProcessor. Some records are ...
0
votes
1
answer
204
views
What is the optimal way to filter rows from a DataTable?
I'm looking for the easiest and fastest way to get DataRows from a DataTable.
These DataRows have several columns including one with Integer and I only want the rows with the highest value.
Currently ...
0
votes
1
answer
281
views
How to get the datatable with selected rows from stored procedure?
I got 8 rows with column names from stored procedure. I read this as DataTable. However, I only want three columns with reference to employeeID.
This is the table I get after I run the procedure.
I ...
0
votes
2
answers
125
views
Looking for a generic function to read columns from a DataRow and set them to variables
I have a DataRow loaded with data from an SQL view. I then read the columns of the DataRow and assign them to an Object which properties are actually the column names of the sql view. The goal is to ...
3
votes
1
answer
2k
views
Xunit Method on Datarow
I would be grateful for assistance with the following question.
I would like to evaluate one or more data series with Xunit.
For this I have programmed a simple example.
Read the data series 10,20,30,...
0
votes
1
answer
104
views
xunit test previousValue
I would like to evaluate a data series and output the respective previous value.
For this I use the following code:
private int PrevInt(int CurrentInt)
{
PrevIntList.Add(CurrentInt);
...
1
vote
1
answer
387
views
Can System.Data.DataRow used for SQL injection? [duplicate]
I am aware that for SqlCommand I have to use SqlParameter when passing parameters to the query, to avoid SQL injection. But what about the DataRow? For example:
row.UserComment = tbUserComment.Text;
...
0
votes
1
answer
662
views
How do i modify the value of DataRow in flutter?
I have a 2 DataRow that I query from the firebase database and I want to multiply the value of qty with the value in total, I have the value of 1 in a variable qty as shown here int qty = 1; in my ...
0
votes
1
answer
1k
views
DataRow.ItemArray does not have values and is empty
my DataRow object is emtpy no matter how I try to initialize it. Here is the source code:
private DataTable ReadFileIntoDb(MemoryStream file)
{
file.Position = 0;
var sr =...
0
votes
2
answers
823
views
C# equivalent to VB's "System.Data.DataRow.Item"?
I'm trying to find an equivalent of VB's "System.Data.DataRow.Item" but I can't find one. I'm re-writing VB code to C# and I'm new to C#. Noob question, probably. I figured you guys would ...
0
votes
0
answers
56
views
Value in DataTable Reverting After Being Changed
I am iterating through a DataTable and doing some comparisons. If values match I set a flag to true.
I have several cases where the it finds the match, sets the flag (I verify it right after it's set)...
0
votes
1
answer
562
views
C# Concat DataTable Columns datatable as enumerable
What I am trying to do is concate two string columns and use them as one. I have seen many questions and answers on that but didn't really fix my problem.
I have a data table like the below which has ...
0
votes
1
answer
6k
views
How to get a DataRow from object
I am trying to reuse some code from a project that works with DataRow instead of object. In my new project I have the model created and I work all with objects but Im trying to bring that piece of ...
0
votes
1
answer
56
views
Hide tabledata by checkbox
I haven a question:
How can i hide some tabledata if a checkbox is checked?
I tried a few similar solutions on this web but couldn't find the right solution.
This is the HTML of the checkbox:
...
0
votes
0
answers
525
views
Use Rows.Find to Search DataTable for String Value
I have a bit of code that I'm stuck on. I am trying to search the ReasonCodeTable for some values in the DataRow from R64CodeTable so that I can update it.
Find(_rcdr["Reason Code"]) Works ...
0
votes
0
answers
244
views
Unable to Update DataTable, No Primary Key
I am updating a DataTable, and when I do it says Table doesn't have a primary key. I changed how I created the table, and added a PrimaryKey, so what's going on?
I create the table, add columns, and ...
0
votes
0
answers
279
views
copy Datarow to new Datatable
Hy there.
I have a problem when copying a row from a datatable to another one.
I know the question was make from a lot of people and there's a lot of solution, but i didn't found any that work for me
...
0
votes
1
answer
2k
views
Compare two DataTables rows by specific identifier and marking them accordingly
I have two exactly same DataTables ("Old" and "New") and I want to compare rows with same identifier.
For example both datatables (dt1 , dt2) have "ID" column and so I ...
-1
votes
2
answers
1k
views
DataRow "Specified Cast is invalid" C#
Can't figure out why this won't work. I get the same "Specified Cast is Invalid" error message. New to C#, be kind. It fails at the if(!((int)WrkRow["ManualWeight"] == 1 | etc. ...
4
votes
2
answers
1k
views
print an entire table in C#
I'm trying to print the content of a DataTable, starting with the column headers, followed by the content of the table tupples.
output.Add($"Table : [{dataTable.TableName}]");
string ...
1
vote
1
answer
1k
views
How do you correctly and quickly compare Datarows / Datatables?
Update: to explain what type of Datatables I Am comparing-
"Compare two Datatables with the same columns, one Datatable is being pulled form an external server and inserted Initially, from then ...
0
votes
1
answer
457
views
copy one or more selected row from Janus Grid to DataRowCollection or DataRow[]
I have a Janus Grid with a checkbox in each row and wanna copy selected row(s) to a DataRowCollection or to DataRow[] .this is my way but not completed and not worked:
also this grid has group on one ...
1
vote
3
answers
470
views
How to strongly type "Current" when implementing IEnumerator
We are implementing IEnumerator and IEnumerable in our class
static void Main(string[] args)
{
ParsingFile data = new ParsingFile();
foreach (var line in data) // ...
-1
votes
1
answer
82
views
How do I get the value of a datarow after a space in c#?
So say I have a two word name in a DataRow with a space in between words. The entire name is represented as "poc" in the datarow. I can get the poc to display the full name no problem. The ...
0
votes
1
answer
325
views
How to edit datetime column in a dataset?
My dataset has column ' START_DATE' and its in datetime format.
this is what i tried so far.
foreach (DataRow dR in codeDs.Tables[0].Rows)
{
var def_startDate = Convert.ToDateTime(dR["...
0
votes
1
answer
455
views
How to add a DataCell to a DataRow?
In my code I want that the user can add a new DataCell to a DataRow in my DataTable. But I dont know how I can add a single DataCell. My Code looks like this, but it didnt work:
List<DataRow> ...
0
votes
1
answer
2k
views
Call an async method on pageload and wait for to complete the execution - c#
I want to call a web api method on page load event of my project. But I want to wait for the execution of the function 'GetSelectedTaskDetails' to complete. So that I can manage with the values from ...
-1
votes
2
answers
894
views
Display deleted rows in a DataTable
So I have a DataTable that I bind to the DataGrid in XAML.
User is allowed to add, modify and remove rows for a table. I would like to mark rows with a specific colour, depending on the action that ...
1
vote
1
answer
439
views
How to insert a Data Row in the first line in a DataTable?
i have a DataTable, where i want to add Rows. The Code works, but the Data Row gets add below the last Data Row. I want to add a Row at the top. I used list.insert(0, element) but it didnt work.
This ...
1
vote
1
answer
2k
views
How to set fields in DataRow object
I have migrated legacy code from vb to c#. The following migrated line of code raises an error:
using System.Data;
..
..
DataRow targetDataRow = targetDataTable.NewRow();
targetDataRow.SetField("...
0
votes
0
answers
156
views
How to properly use array Contains() on an Array Type DataColumn
I'm trying to match a string inside a DataRow that holds a string array.
I was able to achieve that once the column type was only string, but now it's a string array per row.
The DataTable is a ...
-1
votes
1
answer
866
views
How to insert x number of datarows from a datatable into a list?
I'm currently using an existing piece of code that can insert all data rows from a specified data table column into a list as integers. However, in the current code I can only add all data rows. I ...
0
votes
2
answers
656
views
C# Index 0 is either negative or above rows count with DataRowView - why?
I know this is a classic error but I'm not aware of what is happening.
I have a DataSet and then I evaluate if it is filled before moving on, like this:
if (
ds == null
...
0
votes
1
answer
85
views
How to fix late binding for datarow in datacollection where datarow variable defined in range
I'm in the process of converting VB to C#.Net for my company. In order to do this more easily, I have option strict ON. I am trying to resolve a late binding on the following code. Row is considered ...
0
votes
1
answer
413
views
Get a row from a datatable in C# Visualstudio and then store the row in a datarow
I have a dataset in c# visual studio. I have one of column values of the one of the rows. I need to select that row using that value and store it in a datarow so that I can delete it. So how can I get ...
1
vote
1
answer
4k
views
Filter DATATABLE Rows with multiple Values in columns
I have a DataTable (dt) with multiple columns which is the source to DataGridView. I am trying to filter this DataTable(dt) with a list of values of a particular column.
I need to filter the Below ...
0
votes
0
answers
901
views
GridControl showing no data but empty rows C#
I have a gridcontrol which needs to be populated with some data.
I have created a datatable and populated data in datarow and added to the table. Data is present in table on analysis. Datatable is ...
1
vote
1
answer
2k
views
How to convert datarow to generic model class?
I have a lot of model classes that I fill in with data from API.
Structure of API data is DataRow.
For each class there is an implicit conversion from DataRow to model class.
I have to write a set of ...
-4
votes
1
answer
685
views
Binding selected row to new data row and using import row VB.NET
I am binding a selected row to a new data row which needs to be added to a database.
I am using the dt.Importrow(newRow) to add the new datarow to the data table.
However, if I make changes to this ...
0
votes
1
answer
939
views
C# Parallel.ForEach - randomly writes a null value to the DataRow
Why does the following code at random times write null values to the DataRow object?
ConcurrentDictionary<long, DataRow> dRowDict = new ConcurrentDictionary<long, DataRow>();
foreach (...