Все вопросы: [datatable]

362 вопросов

6
голосов
1ответов
4461 просмотров

Remove duplicates from DataTable and custom IEqualityComparer<datarow></datarow>

How have I to implement IEqualityComparer&lt;DataRow&gt; 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&lt;DataRo...

8
голосов
1ответов
6560 просмотров

Concurrency violation: the UpdateCommand affected 0 of the expected 1 records

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, "WEBFILE...

2
голосов
2ответов
35132 просмотров

C# DataTable.Select() - How do I format the filter criteria?

this doesn't work DataRow[] mySelectedRows = myDataTable.Select("processed &lt;&gt; 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?

0
голосов
2ответов
588 просмотров

Spreadsheet from DataTable

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 c...

38
голосов
4ответов
149446 просмотров

DataTable, How to conditionally delete rows

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 ...

2
голосов
2ответов
709 просмотров

ADO .NET - adding a DataTable to more than one DataSet

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 t...

0
голосов
3ответов
700 просмотров

Linq with DataTables vs plain SQL

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...

0
голосов
2ответов
2687 просмотров

DataTable.AsEnumerable().Distinct() doesn't work because of primary key column

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 - becau...

1
голосов
1ответов
5606 просмотров

How to implement DataTable property with INotifyPropertyChanged

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 { ... ... ...

4
голосов
6ответов
5925 просмотров

YUI Datatable Width

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 datata...

0
голосов
1ответов
1652 просмотров

MVVM binding DataGrid (WPF Toolkit) to DataTable

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?

1
голосов
1ответов
79 просмотров

What is wrong with this auto-generated t-sql query?

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("MyS...

2
голосов
3ответов
2583 просмотров

Removing rows from datatable + AcceptChanges

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, like so: For i As Integer = 0 To dtFixedActs.Count - 1 For j As Integer = 0 To dtTotals.Count - 1 If dtFixe...

5
голосов
3ответов
19112 просмотров

How to use a Distinct on a column using Linq

Here is my code: var query = from row1 in table.AsEnumerable() let time = row1.Field&lt;DateTime&gt;("time") let uri = row1.Field&lt;string&gt;("cs-uri-stem") let ip = row1.Field&lt;string&gt;("c-ip") ...

0
голосов
1ответов
3447 просмотров

Add hyperlinks to datatable

I would like to add hyperlinks dynamically to the cell of a specific column in my datatable. Currently my code is only showing the text. Here is my code: SqlConnection conn = null; string sSQL = ""; string connString = "Datasourceetc"; sSQL = "SELECT TEST_ID FROM TEST_TABLE"; SqlDataAdapter s...

2
голосов
2ответов
9694 просмотров

How do you change specific data in a datatable column?

I've populated a DataTable with a DataAdapter but I would like to change the values dynamically for all of the rows in that column in the DataTable. How do I go about doing this? Here is my current code: SqlConnection conn = null; string sSQL = ""; string connString = "Datasourceetc"; sSQL = ...

2
голосов
1ответов
408 просмотров

DataTable descendant with DebuggerDisplay attribute loses DebuggerVisualizer

I have a descendant of DataTable that has the DebuggerDisplay attribute defined. The default visualizer for DataTable is removed when I add the DebuggerDisplay attribute. If I remove the DebuggerDisplay attribute, the DataTable visualizer returns. I want the default DataTable visualizer and my ov...

0
голосов
1ответов
1552 просмотров

Store Image in DataTable

I want to store image into my datatable and while adding colum I want to set its default value, sending you code doing with checkboxes.. public void addCheckBoxesRuntime(){ for (int i = 0; i dt.DataType = typeof(Boolean); viewDataTable.Columns.Add(dt); dt.D...

0
голосов
4ответов
585 просмотров

Need to add "rollup" of entire dataset to bottom of DataGrid that is paged

In ASP.NET 3.5 I have a datagrid that is bound to a somwehat dynamic datatable. The datatable is created by taking three different tables returned from a dataset and combining them to create one table. It goes like this. The first datatable returns a list of the columns that will be in the fin...

10
голосов
5ответов
49206 просмотров

Is it possible to insert an entire VB.NET DataTable into a SQL Server at once

I have a SQLClient.DataSet in VB.NET, and I want to insert the entire thing into a SQL Server table without having to do the following: For Each dr as Datarow in MyDataset Dim sc As New SqlCommand("INSERT INTO MyNewTable " &amp; _ "VALUES (@column1, @column2)", MyDB...

0
голосов
5ответов
698 просмотров

Return DataTable based on boolean param

I have a table that has a field, "IsActive," that indicates whether a record has been "deleted" or not. Currently, I retrieve this info like so: public DataTable GetContractors(bool IsActive) { SqlParameter paramIsActive = new SqlParameter("@IsActive", SqlDbType.Bit); pa...

1
голосов
1ответов
592 просмотров

an entire DataTable object to byte then saved in database

im tasked to create a virtual database that clients can create from our web application and have them save data to. the problem now is to have it stored for later re-use. im thinking of dynamically creating a DataTable object in c# then convert it to byte[]. now i want to know if this would be ...

0
голосов
1ответов
2418 просмотров

c# DataTable.Select: problem with '-' character

I have a problem in a C# project. I am using the Select method with a DataTable object. If I put a '-' in the search string I select nothing. So here is a code sample of what I have: DataTable table; DataRow[] rows = table.Select("[Radio Name] LIKE '*Lounge-MP3-96*'"); But there is a column wi...

0
голосов
2ответов
1764 просмотров

Coule not add checkbox in datatable at runtime C# wpf

private void SetAppData() { ArrayList alDiscoveredNodes = this.DiscoverNetworNodes(); //initializeViewDataTable will add colums to ViewDataTable that will be shown on View initializeViewDataTable(alDiscoveredNodes); Application.Current.Dispatcher.Begi...

0
голосов
3ответов
2453 просмотров

C# code optimization for accessing datatable records

i have a cost issue with datatable. And i need to replace the code with a smarter one. i have a datatable and the sample values are like this: Columns : id, user_id, starttime, endtime Row Sample : 1 , 5, 05.10.2009 08:00:00,05.10.2009 17:00 my pseudo code is function something() ...

6
голосов
1ответов
5400 просмотров

Dump C# DataTable to a file

Is there a quick and dirty way to dump the contents of a System.Data.DataTable to a text file or some other 'thing' for debugging purposes?

4
голосов
1ответов
6528 просмотров

how to get jsf clientid of a component in datatable?

i am trying to get the client id of a component in a datatable. the problem is that jsf puts row index before the component id automatically, i.e. &lt;a id="mappedidentifier_table:1:mappedidentifier_Update" href="#"&gt;Update&lt;/a&gt; for a link in the second row (index=1). i am using th...

0
голосов
1ответов
1889 просмотров

DataGridView displays empty cells when bound to typed DataTable

I'm creating a simple application that simply populates a DataGridView with a strongly typed DataTable. My problem is that all the cells show up empty despite containing data, I have a CellDoubleClick event which can pick up the underlying value of the cell (which is typed as expected) but the c...

0
голосов
2ответов
15850 просмотров

DataTable Rows.IndexOf()

I am trying to find a row and then delete that row from a datatable. I keep getting nIndex = -1. Anyone have suggestions? protected void cbxSelected_CheckedChanged(object sender, EventArgs e) { CheckBox checkbox = (CheckBox)sender; GridViewRow row = (GridViewRow)checkbox.NamingContainer; stri...

0
голосов
2ответов
1274 просмотров

.NET 2.0 webservice not returning DataTable

I have a webservice method defined as so: [WebMethod] public DataTable GetResponseCodeTypes() { // connect to database and retrieve results, // then populate and return a DataTable } The method has been verified via the webservice test form and returns a DataTable as expected: &lt;?xml ve...