datatable

.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: <?xml version="1.0" encoding="utf-8"?> <DataTable xml...

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; string sSampleId = row.Cells[1].Text; if (!s...

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 column is shown as empty. Objects of type ...

how to get jsf clientid of a component in datatable ?

hi there, 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. <a id="mappedidentifier_table:1:mappedidentifier_Update" href="#">Update</a> for a link in the second row (index=1). i am using the following methods to get the clientId ...

IceSoft DataTable

I have an IceSoft dataTable, with the rows populated by an EJB. Some of the columns are input text fields, and when the page first fires up, the fields are populated with what is in the db. I want the user to be able to change any of the text in the input text fields, then hit "save", and have it saved in the db. Do I need to iterate o...

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

C# code optimization for accessing datatable records

Hi, 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() { for(int i=0;i<datatable.Rows...

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.BeginInvoke(System.Windows.Threading.DispatcherPr...

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

Hi! 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 with: Radio Name = 1.FM - The Chillout L...

an entire DataTable object to byte then saved in database

hello, 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 practical to save on a database......

Return DataTable based on boolean param

Hi All, 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); paramIsActive.Value = IsActive; ...

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 " & _ "VALUES (@column1, @column2)", MyDBConnection) sc.Parameters.AddWithValue("@col...

DataTable Cancel Row Delete

Hi, I have a windows form which has a DataGrid control (Not DataGridView) on it. The DataGrid control is bound ot to a DataTable. Everytime the user presses delete button on one of the rows on the grid, I want to check a condition and stop the row from being deleted if the condition is false. I have subscribed to the RowDeleting ev...

Copy a DataTable to memory and restore it later

I would like to do something like this (pseudo code): var Customer = select * from customer from my database doManyThings Restore varCustomer to Database I can't use LINQ-to-SQL because I have a hierarchyID. How do I this using DataTable, DataReader or other options? ...

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 final datatable. The second datatable return...

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 < InformationOne.Length; i++) { dt = new DataColumn(InformationOne[i][1] + " (" + InformationOne[i][0] + " ...

DataTable descendant with DebuggerDisplay attribute loses DebuggerVisualizer

Hello, 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 override for DebuggerDisplay. Do y...

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 = "SELECT TEST_ID FROM TEST_TABLE"; SqlData...

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 sda = new SqlDataAdapter(sSQL, conn); Data...

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<DateTime>("time") let uri = row1.Field<string>("cs-uri-stem") let ip = row1.Field<string>("c-ip") let questionid = row1.Field<int>("questionid") ...