Hi everybody,
I have 2 datatables in my ASP.NET application. I loop though both of them, and if I find a match, I delete that particular row from the outer datatable, lik so:
For i As Integer = 0 To dtFixedActs.Count - 1
For j As Integer = 0 To dtTotals.Count - 1
If dtFixedActs.Rows(i).Item("Activity...
I'm having trouble executing a stored proc...
I've got C# code that tries to call the stored proc. It looks somewhat like this:
DataTable myDataTable = new DataTable();
using (SqlConnection connection = new SqlConnection(myConnectionString))
{
SqlCommand selectCommand = new SqlCommand("MyStoredProc", connection);
selectCommand...
I use MVVM for my project, the binding that set to DataTable work correctly at first time, but after I have update data on DataTable, it seem don't effect on DataGrid. Anyone know how to solving it?
...
This may seem like a basic question, but I'm having trouble figuring out how to set the table width to 100% on a YUI datatable.
I tried doing
#dtContainer {
width: 100%;
}
#dtContainer table {
width: 100%
}
but none of these approaches work.
To clarify, I am trying to set the datatable width to 100% when the table is empty ...
I have created WPF MVVM application, and set WPFToolkit DataGrid binding to DataTable so I want to know how to implement DataTable property to notify changed. Currently my code is like below.
public DataTable Test
{
get { return this.testTable; }
set
{
...
...
base.OnPropertyChanged("Test");
}
}...
I want to remove duplicates from my DataTable so I'm using DataTable.AsEnumerable().Distinct(DataRowComparer.Default) but it doesn't do what I need. I think because each duplicate row has it's unique primary key column.
How can I do what I need? Write my own DataRowComparer? I don't want - because the default must works.
...
I'm working on an app that generates reports that are basically standard SQL operations (sum/average on data grouped by A/B where X=Y etc)
the parts of the query can be defined by the user at runtime. as implemented, the raw data is in a a DataTable and I "parse" the query parameters into a linq expression (basically query operands map ...
I'd like to add a DataTable to more than one DataSet without calling DataTable.Copy(). Simply copying the DataTable doubles the amount of data in memory and causes me to manage its changes. This problem exists because I am implementing a detail tables solution where a detail table can have more than one master.
If it helps, consider thi...
I'm engaged in a C# learning process and it is going well so far. I however just now hit my first "say what?" moment.
The DataTable offers random row access to its Rows collection, not only through typical collections behavior, but also through DataTable.Select. However I cannot seem to be able to tie this ability to DataRow.Delete. So ...
In my app, I'm downloading a spreadsheet from FTP, moving the data read from the spreadsheet to a DataTable, and, depending on certain conditions, emailing a new spreadsheet (one that contains certain rows from the 1st spreadsheet).
My problem is creating the spreadsheet that will be mailed. I can't seem to work out how to add the row f...
Hi everyone. this doesn't work
DataRow[] mySelectedRows = myDataTable.Select("processed <> True");
myDataTable has a row named processed. I would like to select the rows from this table where processed is not equal to True. Can anyone help?
...
Here is the code, any ideas why I get this error?
private SQLiteDataAdapter DA_Webfiles;
// Setup connection, fill dataset etc
DataTable dt = this.dataSet.Tables["WEBFILES"];
DataRow newRow = dt.NewRow();
newRow["PATH"] = _url;
dt.Rows.Add(newRow);
this.DA_Webfiles.Update(this.dataSet, "WEBFILES");
// Works to Here
newRow["CONTENT_TYP...
How have I to implement IEqualityComparer<DataRow> to remove duplicates rows from a DataTable with next structure:
ID primary key, col_1, col_2, col_3, col_4
The default comparer doesn't work because each row has it's own, unique primary key.
How to implement IEqualityComparer<DataRow> that will skip primary key and compare only data...
Hello All,
One approach I've tried to solve my problem of needing to be able to dynamically add columns to a databound xamDataGrid is to bind to a .NET DataTable. At startup, I hard-code some data into the DataTable. Then I provide a button which, when clicked, is supposed to add a new column and put random numbers in the new column. I ...
I'm experiencing some weird behavior when trying to modify some DataTable objects. Upon the second call to the subroutine, I get the following error when I to copy the source DataTable to a working set:
System.Data.ConstraintException was
caught Message="Column 'pk' is
constrained to be unique. Value
'path0.tag0' is already...
Hi,
I have two datatables.There are few identical columns in both of them.Now I need to compare each Identical column's cell in both the datatables and build a third datatable by merging the changes of identical column's cells and also the un-identical columns.Please help me with C# code in doing it.
Thanks,
Vix
...
I know the method below isn't meant to work with any Entity, and its use shouldn't be enforced.
I found a System.Data.Linq.Table extension method which uses SqlBulkCopy to insert data. I am trying to adapt it to the Entity Framework but it throws a strange exception, while the original works for Linq-To-Sql data classes. I couldn't find...
Hello,
What is the best method for saving thousands of rows and after doing something, updating them.
Currently, I use a datatable, filling it, when done inserting by
MyDataAdapter.Update(MyDataTable)
After doing some change on MyDataTable, I again use MyDataAdapter.Update(MyDataTable) method.
Edit:
I am sorry for not providing m...
I'd like to convert a DataTable to an IEnumerable<> of Dictionary<string, object>. I tried the following LINQ query,
from DataRow row in ds.Tables[0].AsEnumerable()
let rowDictionary = new Dictionary<string, object>()
from DataColumn column in row.Table.Columns.Cast<DataColumn>()
select rowDictionary.Add(column.ColumnName, row[column]...
I have a datatable that i want to query.
the query is very large and complicated and it works when i run it in the SQl Server Editor - so i have the query text.
i need to query the datatable with this query String.
To Translate the query into linq will take years, and also Select() method of DataTable won't handle it.
How can i operate...