Search Results

Search found 1168 results on 47 pages for 'datatable'.

Page 10/47 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Exporting DataTable using FileHelpers

    - by Dat
    I want to export the contents of a DataTable to a text delimited file using FileHelpers, is this possible? Here is what I have so far: // dt is a DataTable with Rows in it DelimitedClassBuilder cb = new DelimitedClassBuilder("MyClassName", "|", dt); Type t = cb.CreateRecordClass(); FileHelperEngine engine = new FileHelperEngine(t); I have to convert the contents of dt to an array of type "MyClassName" but I'm not sure how to do that? I know there is a FileDataLink class but none of them work with DataTable (or even a DataSet).

    Read the article

  • jQuery Datatable in MVC &hellip; extended.

    - by Steve Clements
    There are a million plugins for jQuery and when a web forms developer like myself works in MVC making use of them is par-for-the-course!  MVC is the way now, web forms are but a memory!! Grids / tables are my focus at the moment.  I don’t want to get in to righting reems of css and html, but it’s not acceptable to simply dump a table on the screen, functionality like sorting, paging, fixed header and perhaps filtering are expected behaviour.  What isn’t always required though is the massive functionality like editing etc you get with many grid plugins out there. You potentially spend a long time getting everything hooked together when you just don’t need it. That is where the jQuery DataTable plugin comes in.  It doesn’t have editing “out of the box” (you can add other plugins as you require to achieve such functionality). What it does though is very nicely format a table (and integrate with jQuery UI) without needing to hook up and Async actions etc.  Take a look here… http://www.datatables.net I did in the first instance start looking at the Telerik MVC grid control – I’m a fan of Telerik controls and if you are developing an in-house of open source app you get the MVC stuff for free…nice!  Their grid however is far more than I require.  Note: Using Telerik MVC controls with your own jQuery and jQuery UI does come with some hurdles, mainly to do with the order in which all your jQuery is executing – I won’t cover that here though – mainly because I don’t have a clear answer on the best way to solve it! One nice thing about the dataTable above is how easy it is to extend http://www.datatables.net/examples/plug-ins/plugin_api.html and there are some nifty examples on the site already… I however have a requirement that wasn’t on the site … I need a grid at the bottom of the page that will size automatically to the bottom of the page and be scrollable if required within its own space i.e. everything above the grid didn’t scroll as well.  Now a CSS master may have a great solution to this … I’m not that master and so didn’t! The content above the grid can vary so any kind of fixed positioning is out. So I wrote a little extension for the DataTable, hooked that up to the document.ready event and window.resize event. Initialising my dataTable ( s )… $(document).ready(function () {   var dTable = $(".tdata").dataTable({ "bPaginate": false, "bLengthChange": false, "bFilter": true, "bSort": true, "bInfo": false, "bAutoWidth": true, "sScrollY": "400px" });   My extension to the API to give me the resizing….   // ********************************************************************** // jQuery dataTable API extension to resize grid and adjust column sizes // $.fn.dataTableExt.oApi.fnSetHeightToBottom = function (oSettings) { var id = oSettings.nTable.id; var dt = $("#" + id); var top = dt.position().top; var winHeight = $(document).height(); var remain = (winHeight - top) - 83; dt.parent().attr("style", "overflow-x: auto; overflow-y: auto; height: " + remain + "px;"); this.fnAdjustColumnSizing(); } This is very much is debug mode, so pretty verbose at the moment – I’ll tidy that up later! You can see the last call is a call to an existing method, as the columns are fixed and that normally involves so CSS voodoo, a call to adjust those sizes is required. Just above is the style that the dataTable gives the grid wrapper div, I got that from some firebug action and stick in my new height. The –83 is to give me the space at the bottom i require for fixed footer!   Finally I hook that up to the load and window resize.  I’m actually using jQuery UI tabs as well, so I’ve got that in the open event of the tabs.   $(document).ready(function () { var oTable; $("#tabs").tabs({ "show": function (event, ui) { oTable = $('div.dataTables_scrollBody>table.tdata', ui.panel).dataTable(); if (oTable.length > 0) { oTable.fnSetHeightToBottom(); } } }); $(window).bind("resize", function () { oTable.fnSetHeightToBottom(); }); }); And that all there is too it.  Testament to the wonders of jQuery and the immense community surrounding it – to which I am extremely grateful. I’ve also hooked up some custom column filtering on the grid – pretty normal stuff though – you can get what you need for that from their website.  I do hide the out of the box filter input as I wanted column specific, you need filtering turned on when initialising to get it to work and that input come with it!  Tip: fnFilter is the method you want.  With column index as a param – I used data tags to simply that one.

    Read the article

  • ListBox Items Not Visible after DataBinding

    - by SidC
    Good Evening All, I am writing a page that allows users to search a parts table, select quantities and a listbox is to be populated with gridview values. Here's a snippet of my aspx page: <asp:ListBox runat="server" ID="lbItems" Width="155px"> <asp:ListItem></asp:ListItem> <asp:ListItem></asp:ListItem> <asp:ListItem></asp:ListItem> <asp:ListItem></asp:ListItem> <asp:ListItem></asp:ListItem> </asp:ListBox> Here's the relevant contents of codebehind: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Define DataTable Columns as incoming gridview fields Dim dtSelParts As DataTable = New DataTable Dim dr As DataRow = dtSelParts.NewRow() dtSelParts.Columns.Add("PartNumber") dtSelParts.Columns.Add("NSN") dtSelParts.Columns.Add("PartName") dtSelParts.Columns.Add("Qty") 'Select those gridview rows that have txtQty <> 0 For Each row As GridViewRow In MySearch.Rows Dim textboxText As String = _ CType(row.FindControl("txtQty"), TextBox).Text If textboxText <> "0" Then 'Create the row dr = dtSelParts.NewRow() 'Fill the row with data dr("PartNumber") = MySearch.DataKeys(row.RowIndex)("PartNumber") dr("NSN") = MySearch.DataKeys(row.RowIndex)("NSN") dr("PartName") = MySearch.DataKeys(row.RowIndex)("PartName") 'Add the row to the table dtSelParts.Rows.Add(dr) End If Next 'Need to send items to Listbox control lbItems lbItems.DataSource = New DataView(dtSelParts) lbItems.DataValueField = "PartNumber" lbItems.DataValueField = "NSN" lbItems.DataValueField = "PartName" lbItems.DataBind() End Sub The page runs fine in that my search functiobnality is intact, and I can input quantity values into my gridview's textbox. When I click Add to Quote the Listbox receives focus, but no list items are visible. I've created several list items in the aspx page, however I don't know how to populate the contents of my datatable in the listbox. Can someone help a newbie with this, seemingly, easy issue? Thanks, Sid

    Read the article

  • How do I get column names to print in this C# program?

    - by Kevin
    I've cobbled together a C# program that takes a .csv file and writes it to a datatable. Using this program, I can loop through each row of the data table and print out the information contained in the row. The console output looks like this: --- Row --- Item: 1 Item: 545 Item: 507 Item: 484 Item: 501 I'd like to print the column name beside each value, as well, so that it looks like this: --- Row --- Item: 1 Hour Item: 545 Day1 KW Item: 507 Day2 KW Item: 484 Day3 KW Item: 501 Day4 KW Can someone look at my code and tell me what I can add so that the column names will print? I am very new to C#, so please forgive me if I've overlooked something. Here is my code: // Write load_forecast data to datatable. DataTable loadDT = new DataTable(); StreamReader sr = new StreamReader(@"c:\load_forecast.csv"); string[] headers = sr.ReadLine().Split(','); foreach (string header in headers) { loadDT.Columns.Add(header); // I've added the column headers here. } while (sr.Peek() > 0) { DataRow loadDR = loadDT.NewRow(); loadDR.ItemArray = sr.ReadLine().Split(','); loadDT.Rows.Add(loadDR); } foreach (DataRow row in loadDT.Rows) { Console.WriteLine("--- Row ---"); foreach (var item in row.ItemArray) { Console.Write("Item:"); Console.WriteLine(item); // Can I add something here to also print the column names? } }

    Read the article

  • Cross field validation in jsf h:datatable using p:calendar

    - by Matt Broekhuis
    I noticed this question was asked, but it has not been answered correctly. I have a datatable that has two columns start date and end date. Both contain primefaces p:calendar controls in them. I need to ensure that for each row that the date in column1 is not after the date in column2. I would like to tie this into the JSF validation framework, but I'm having trouble. i've tried marking the datatable rowStatePreserved="true" , this allows me to get the values, but something is still wrong as when it fails, all the values in the first row overwrite all the other values. What am I doing wrong, or should I be using a completely different strategy? xhtml code <h:form> <f:event type="postValidate" listener="#{bean.doCrossFieldValidation}"/> <p:dataTable id="eventDaysTable" value="#{course.courseSchedules}" var="_eventDay" styleClass="compactDataTable" > <p:column id="eventDayStartColumn"> <f:facet name="header"> Start </f:facet> <p:calendar id="startDate" required="true" value="#{_eventDay.startTime}" pattern="MM/dd/yyyy hh:mm a"/> </p:column> <p:column id="eventDayEndColumn"> <f:facet name="header"> End </f:facet> <p:calendar id="endDate" required="true" value="#{_eventDay.endTime}" pattern="MM/dd/yyyy hh:mm a"/> </p:column> </p:dataTable> </h:form> validationCode public void doCrossFieldValidation(ComponentSystemEvent cse) { UIData eventsDaysStable = (UIData) cse.getComponent().findComponent("eventDaysTable"); if (null != eventsDaysStable && eventsDaysStable.isRendered()) { Iterator<UIComponent> startDateCalendarIterator = eventsDaysStable.findComponent("eventDayStartColumn").getChildren().iterator(); Iterator<UIComponent> endDateCalendarIterator = eventsDaysStable.findComponent("eventDayEndColumn").getChildren().iterator(); while (startDateCalendarIterator.hasNext() && endDateCalendarIterator.hasNext()) { org.primefaces.component.calendar.Calendar startDateComponent = (org.primefaces.component.calendar.Calendar) startDateCalendarIterator.next(); org.primefaces.component.calendar.Calendar endDateComponent = (org.primefaces.component.calendar.Calendar) endDateCalendarIterator.next(); Date startDate = (Date) startDateComponent.getValue(); Date endDate = (Date) endDateComponent.getValue(); if (null != startDate && null != endDate && startDate.after(endDate)) { eventScheduleChronologyOk = false; startDateComponent.setValid(false); endDateComponent.setValid(false); } } if (!eventScheduleChronologyOk) { showErrorMessage(ProductManagementMessage.PRODUCT_SCHEDULE_OUT_OF_ORDER); } } }

    Read the article

  • Read DataTable by RowState

    - by RBrattas
    I am reading my DataTable as follow: foreach ( DataRow o_DataRow in vco_DataTable.Rows ) { //Insert More Here } It crash; because I insert more records. How can I read my DataTable without reading the new records? Can I read by RowState? Thanks

    Read the article

  • Add a datatable to a data set

    - by Jibu P C_Adoor
    Hii... I have a data table 'dt1' that is belongs to 'ds1'. I have created another instance of dataset 'ds2' and try to add the datatable 'dt1' to 'ds2'. Now i got one exception 'DataTable already belongs to another data set'. Is there any reliable way to add the dt1 to ds2?

    Read the article

  • How to change the datasource on a YUI datagrid after creation

    - by Simon
    I am using the Yahoo DataTable for which the API is here. I am having difficulty changing the data once I have rendered the grid once. I am using jQuery to get data via AJAX, or from a client side data island and need to put this back into the grid. There is no setDataSource method in the DataTable API, and changing 'dataSource.liveData' does not update the grid. // does not work dataTable.dataSource.liveData = [ {name:"cat"}, {name:"dog"}, {name:"mouse"}; The example I am basing my code on is the basic LocalDataSource example. How can I update the data source without having to completely recreate the table. I do NOT want to use the YUI datasources that make Async calls. I need to know how I can do this 'manually'.

    Read the article

  • How can we copy datacolumn with data from one table to another ?

    - by Harikrishna
    I have one Datatable like DataTable addressAndPhones; And there are four columns name,address,phoneno,and other details and I only want two columns Name and address from that so I do for that is DataTable addressAndPhones2; addressAndPhones2.Columns.Add(new DataColumn(addressAndPhones.Columns["name"].ColumnName)); addressAndPhones2.Columns.Add(new DataColumn(addressAndPhones.Columns["address"].ColumnName)); But it gives me error so how can I copy fix no of columns data from one table to another table ? ERROR :Object reference not set to an instance of an object. EDIT : Only column is copied to another table, data of that column is not copied to another table.

    Read the article

  • Error while coping datacolumn with data from one table to another .

    - by Harikrishna
    I have one Datatable like DataTable addressAndPhones; And there are four columns name,address,phoneno,and other details and I only want two columns Name and address from that so I do for that is DataTable addressAndPhones2; addressAndPhones2.Columns.Add(new DataColumn(addressAndPhones.Columns["name"].ColumnName)); addressAndPhones2.Columns.Add(new DataColumn(addressAndPhones.Columns["address"].ColumnName)); But it gives me error so how can I copy fix no of columns data from one table to another table ? ERROR :Object reference not set to an instance of an object.

    Read the article

  • Is both approach same ?

    - by Harikrishna
    I have one datatable which is not bindided and records are coming from the file by parsing it in the datatable dynamically every time. Now there is three columns in the datatable Marks1,Marks2 and FinalMarks. And their types is decimal. Now for making addition of columns Marks1 and Marks2 's records and store it into FinalMarks column,For that what I do is : datatableResult.Columns["FinalMarks"].Expression="Marks1+Marks2"; It's works properly. It can be done in other way also is foreach (DataRow r in datatableResult.Rows) { r["FinalMarks"]=Convert.ToDecimal(r["Marks1"])+Convert.ToDecimal(r["Marks2"]); } Now I don't know that which is the best way to do this means performance wise. Is first approach same as second approach in background means is both approach same or what?

    Read the article

  • Get drop down selection from GridView on button press

    - by Chris Stewart
    I have an ASP.NET GridView that has four columns. The first three are typical BoundField elements bound to a DataTable. The forth is a TemplateField element that I create a DropDownList in on the OnRowCreated event for the GridView. What I'm attempting to do is walk down the data source for the GridView when a button is pressed. I really just need to get the values for columns one and four of each row. The first three columns have data as expected but the forth is displaying as empty. Is this because it wasn't a part of the DataTable originally? Is there any way to get the value for each drop down as I've described it, or will I need to rework this so each drop down list is a part of the DataTable?

    Read the article

  • how convert DataTable to List<String> in C#

    - by Jitendra Jadav
    Hello Everyone .. I am using C# Linq now I am converting DataTable to List and I am getting stuck... give me right direction thanks.. private void treeview1_Expanded(object sender, RoutedEventArgs e) { coa = new List<string>(); //coa = (List<string>)Application.Current.Properties["CoAFull"]; HMDAC.Hmclientdb db = new HMDAC.Hmclientdb(HMBL.Helper.GetDBPath()); var data = (from a in db.CoA where a.ParentId == 0 && a.Asset == true select new { a.Asset, a.Category, a.CoAName, a.Hide, a.Recurring, a.TaxApplicable }); DataTable dtTable = new DataTable(); dtTable.Columns.Add("Asset", typeof(bool)); dtTable.Columns.Add("Category", typeof(string)); dtTable.Columns.Add("CoAName", typeof(string)); dtTable.Columns.Add("Hide", typeof(bool)); dtTable.Columns.Add("Recurring", typeof(bool)); dtTable.Columns.Add("TaxApplicable", typeof(bool)); if (data.Count() > 0) { foreach (var item in data) { DataRow dr = dtTable.NewRow(); dr["Asset"] = item.Asset; dr["Category"] = item.Category; dr["CoAName"] = item.CoAName; dr["Hide"] = item.Hide; dr["Recurring"] = item.Recurring; dr["TaxApplicable"] = item.TaxApplicable; dtTable.Rows.Add(dr); } } coa = dtTable; }

    Read the article

  • Is is possible to populate a datatable using a Lambda expression(C#3.0)

    - by deepak.kumar.goyal
    I have a datatable. I am populating some values into that. e.g. DataTable dt =new DataTable(); dt.Columns.Add("Col1",typeof(int)); dt.Columns.Add("Col2",typeof(string)); dt.Columns.Add("Col3",typeof(DateTime)); dt.Columns.Add("Col4",typeof(bool)); for(int i=0;i< 10;i++) dt.Rows.Add(i,"String" + i.toString(),DateTime.Now,(i%2 == 0)?true:false); There is nothing wrong in this program and gives me the expected output. However, recently , I am learning Lambda and has done some basic knowledge. With that I was trying to do the same thing as under Enumerable.Range(0,9).Select(i = > { dt.Rows.Add(i,"String" + i.toString(),DateTime.Now,(i%2 == 0)?true:false); }); But I am unsuccessful. Is my approach correct(Yes I know that I am getting compile time error; since not enough knowledge on the subject so far)? Can we achieve this by the way I am doing is a big doubt(as I donot know.. just giving a shot). If so , can some one please help me in this regard. I am using C#3.0 and dotnet framework 3.5 Thanks

    Read the article

  • How to show data in dataTable lable:data in jsf

    - by palakolanusrinu
    Hi How to display lable: data name: srinu in multiple rows using dataTable in jsf right now i'm getting like | lable | data| data srinu i want it in this formate lable: data name: srinu code which used is <h:dataTable id="fundInfo" value="#{clientFundInfo}" border="1" var="client" first="0" rows="5" rules="all"> <h:column> <h:outputText value="CLIENT:"/> <h:outputText value="#{client.clientName}"></h:outputText> </h:column> <h:column> <h:outputText value="FUND:"/> <h:outputText value="#{client.fundName}"></h:outputText> </h:column> <h:column> <h:outputText value="Employer Identification Number:"/> <h:outputText value="#{client.empIdentificationNum}"></h:outputText> </h:column> <h:column><h:outputText value="FISCAL YEAR ENDED:"/> <h:outputText value="#{client.fye}"></h:outputText> </h:column> <h:column><h:outputText value="Shares Outstanding"/> <h:outputText value="#{client.sharesOutstanding}"></h:outputText> </h:column> </h:dataTable>

    Read the article

  • Always get exception when trying to Fill data to DataTable

    - by Sambath
    The code below is just a test to connect to an Oracle database and fill data to a DataTable. After executing the statement da.Fill(dt);, I always get the exception "Exception of type 'System.OutOfMemoryException' was thrown.". Has anyone met this kind of error? My project is running on VS 2005, and my Oracle database version is 11g. My computer is using Windows Vista. If I copy this code to run on Windows XP, it works fine. Thank you. using System.Data; using Oracle.DataAccess.Client; ... string cnString = "data source=net_service_name; user id=username; password=xxx;"; OracleDataAdapter da = new OracleDataAdapter("select 1 from dual", cnString); try { DataTable dt = new DataTable(); da.Fill(dt); // Got error here Console.Write(dt.Rows.Count.ToString()); } catch (Exception e) { Console.Write(e.Message); // Exception of type 'System.OutOfMemoryException' was thrown. } Update I have no idea what happens to my computer. I just reinstall Oracle 11g, and then my code works normally.

    Read the article

  • What can be used instead of Datatable in LINQ

    - by Kabi
    I have a SQL query that returns a Datatable: var routesTable = _dbhelper.Select("SELECT [RouteId],[UserId],[SourceName],[CreationTime] FROM [Routes] WHERE UserId=@UserId AND RouteId=@RouteId", inputParams); and then we can work with Datatable object of routesTable if (routesTable.Rows.Count == 1) { result = new Route(routeId) { Name = (string)routesTable.Rows[0]["SourceName"], Time = routesTable.Rows[0]["CreationTime"] is DBNull ? new DateTime() : Convert.ToDateTime(routesTable.Rows[0]["CreationTime"]) }; result.TrackPoints = GetTrackPointsForRoute(routeId); } I want to change this code to linq but I don't know how can I simulate Datatable in LINQ ,I wrote this part: Route result = null; aspnetdbDataContext aspdb = new aspnetdbDataContext(); var Result = from r in aspdb.RouteLinqs where r.UserId == userId && r.RouteId==routeId select r; .... but I don't know how can I change this part: if (routesTable.Rows.Count == 1) { result = new Route(routeId) { Name = (string)routesTable.Rows[0]["SourceName"], Time = routesTable.Rows[0]["CreationTime"] is DBNull ? new DateTime() : Convert.ToDateTime(routesTable.Rows[0]["CreationTime"]) }; would you please tell me how can I do this? EDIT here you can see the whole block of code in original public Route GetById(int routeId, Guid userId) { Route result = null; var inputParams = new Dictionary<string, object> { {"UserId", userId}, {"RouteId", routeId} }; var routesTable = _dbhelper.Select("SELECT [RouteId],[UserId],[SourceName],[CreationTime] FROM [Routes] WHERE UserId=@UserId AND RouteId=@RouteId", inputParams); if (routesTable.Rows.Count == 1) { result = new Route(routeId) { Name = (string)routesTable.Rows[0]["SourceName"], Time = routesTable.Rows[0]["CreationTime"] is DBNull ? new DateTime() : Convert.ToDateTime(routesTable.Rows[0]["CreationTime"]) }; result.TrackPoints = GetTrackPointsForRoute(routeId); } return result; }

    Read the article

  • How do i solve A datatable problem in JSF

    - by Nitesh Panchal
    I have a databale on index.xhtml <h:dataTable style="border: solid 2px black;" value="#{IndexBean.bookList}" var="item" binding="#{IndexBean.datatableBooks}"> <h:column> <h:commandButton value="Edit" actionListener="#{IndexBean.editBook}"> <f:param name="index" value="#{IndexBean.datatableBooks.rowIndex}"/> </h:commandButton> </h:column> </h:dataTable> My bean :- @ManagedBean(name="IndexBean") @ViewScoped public class IndexBean implements Serializable { private HtmlDataTable datatableBooks; public HtmlDataTable getDatatableBooks() { return datatableBooks; } public void setDatatableBooks(HtmlDataTable datatableBooks) { this.datatableBooks = datatableBooks; } public void editBook() throws IOException{ int index = Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("index").toString()); System.out.println(index); } } My problem is i always get the same index in server log even though i click the different edit buttons, Imagine that there is one collection which is supplied to the datatable. I have not shown that in bean. If i change scope from ViewScope to RequestScope it works fine. What can be the problem with @ViewScoped? Thanks in advance :)

    Read the article

  • C# Type conversion between two similar Datatable objects

    - by Ali
    I have .NET project with sync framework and two separate Datasets for MS SQL and Compact SQL. in my base class I have a generic DataTable object. in my derived classed I assign Typed DataTable to the generic object based on whether the application is operating online or offline: example: if (online) _dataTable = new MSSQLDataSet.Customer; else _dataTable = new CompactSQLDataSet.Customer; Now every where in my code i have to check and do a cast based on the current network mode like this: public void changeCustomerID(int ID) { if (online) (MSSQLDataSet.CustomerDataTable)_dataTable)[i].CustomerID = value; else (CompactMSSQLDataSet.CustomerDataTable)_dataTable)[i].CustomerID = value; } but I don't think this is very efficient and I believe it can be done in a smarter way to only use one line of code by dynamically getting the Type of _dataTable on the run time. my problem is at the design time, in order to acess datatable porperties such as "CustomerID" it has to be casted to either MSSQLDataSet.CustomerDataTable or CompactMSSQLDataSet.CustomerDataTable. Is there a way to have a function or a operator to convert the _datatable to its runtime type but still be able to use it's design time properties which are the same between the two types? something like: ((aType)_dataTable)[i].CustomerID = value; //or GetRuntimeType(_dataTable)[i].CustomerID = value;

    Read the article

  • How To perform a SQL Query to DataTable Operation That Can Be Cancelled

    - by David W
    I tried to make the title as specific as possible. Basically what I have running inside a backgroundworker thread now is some code that looks like: SqlConnection conn = new SqlConnection(connstring); SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(Results); conn.Close(); sda.Dispose(); Where query is a string representing a large, time consuming query, and conn is the connection object. My problem now is I need a stop button. I've come to realize killing the backgroundworker would be worthless because I still want to keep what results are left over after the query is canceled. Plus it wouldn't be able to check the canceled state until after the query. What I've come up with so far: I've been trying to conceptualize how to handle this efficiently without taking too big of a performance hit. My idea was to use a SqlDataReader to read the data from the query piece at a time so that I had a "loop" to check a flag I could set from the GUI via a button. The problem is as far as I know I can't use the Load() method of a datatable and still be able to cancel the sqlcommand. If I'm wrong please let me know because that would make cancelling slightly easier. In light of what I discovered I came to the realization I may only be able to cancel the sqlcommand mid-query if I did something like the below (pseudo-code): while(reader.Read()) { //check flag status //if it is set to 'kill' fire off the kill thread //otherwise populate the datatable with what was read } However, it would seem to me this would be highly ineffective and possibly costly. Is this the only way to kill a sqlcommand in progress that absolutely needs to be in a datatable? Any help would be appreciated!

    Read the article

  • DataGridView.CellValueChanged not firing on bound DataGridView

    - by Wesley
    When I change a value programatically in a DataTable that my DataGridView is bound to, the appropriate CellValueChanged event is not firing for the DataGridView. I'm trying to change a cell's background color based on cell value when the DataTable is filled with data without iterating through every row and checking each value.

    Read the article

  • Datable.Select sort expression

    - by xyz
    Hi, I have datatable with column name tag and 100 rows of data.I need to filter this table with tag starting with "UNKNOWN". What should my sortexpression for datatable.select be ? I'm trying the following. Datarow[] abc = null; abc = dtTagList.Select(string.format("tag='{0}'","UNKNOWN")) How can I achieve tag startswith 'UNKNOWN' in the above code ?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >