Search Results

Search found 1403 results on 57 pages for 'yui datatable'.

Page 8/57 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Updating Cells in a DataTable

    - by Maxim Z.
    I'm writing a small app to do a little processing on some cells in a CSV file I have. I've figured out how to read and write CSV files with a library I found online, but I'm having trouble: the library parses CSV files into a DataTable, but, when I try to change a cell of the table, it isn't saving the change in the table! Below is the code in question. I've separated the process into multiple variables and renamed some of the things to make it easier to debug for this question. Code Inside the loop: string debug1 = readIn.Rows[i].ItemArray[numColumnToCopyTo].ToString(); string debug2 = readIn.Rows[i].ItemArray[numColumnToCopyTo].ToString().Trim(); string debug3 = readIn.Rows[i].ItemArray[numColumnToCopyFrom].ToString().Trim(); string towrite = debug2 + ", " + debug3; readIn.Rows[i].ItemArray[numColumnToCopyTo] = (object)towrite; After the loop: readIn.AcceptChanges(); When I debug my code, I see that towrite is being formed correctly and everything's OK, except that the row isn't updated: why isn't it working? I have a feeling that I'm making a simple mistake here: the last time I worked with DataTables (quite a long time ago), I had similar problems. If you're wondering why I'm adding another comma in towrite, it's because I'm combining a street address field with a zip code field - I hope that's not messing anything up. My code is kind of messy, as I'm only trying to edit one file to make a small fix, so sorry.

    Read the article

  • Difference between DataTable.Load() and DataTable = dataSet.Tables[];

    - by subbu
    Hi All , I have a doubt i use the following piece of code get data from a SQLlite data base and Load it into a data table "SQLiteConnection cnn = new SQLiteConnection("Data Source=" + path); cnn.Open(); SQLiteCommand mycommand = new SQLiteCommand(cnn); string sql = "select Company,Phone,Email,Address,City,State,Zip,Country,Fax,Web from RecordsTable"; mycommand.CommandText = sql; SQLiteDataReader reader = mycommand.ExecuteReader(); dt.Load(reader); reader.Close(); cnn.Close();" In some cases when I try to load it Gives me "Failed to enable constraints exception" But when I tried this below given piece of code for same table and same set of records it worked "SQLiteConnection ObjConnection = new SQLiteConnection("Data Source=" + path); SQLiteCommand ObjCommand = new SQLiteCommand("select Company,Phone,Email,Address,City,State,Zip,Country,Fax,Web from RecordsTable", ObjConnection); ObjCommand.CommandType = CommandType.Text; SQLiteDataAdapter ObjDataAdapter = new SQLiteDataAdapter(ObjCommand); DataSet dataSet = new DataSet(); ObjDataAdapter.Fill(dataSet, "RecordsTable"); dt = dataSet.Tables["RecordsTable"]; " Can any one tell me what is the difference between two

    Read the article

  • InputText inside Primefaces dataTable is not refreshed

    - by robson
    I need to have inputTexts inside datatable when form is in editable mode. Everything works properly except form cleaning with immediate="true" (without form validation). Then primefaces datatable behaves unpredictable. After filling in datatable with new data - it still stores old values. Short example: test.xhtml <h:body> <h:form id="form"> <p:dataTable var="v" value="#{test.list}" id="testTable"> <p:column headerText="Test value"> <p:inputText value="#{v}"/> </p:column> </p:dataTable> <h:dataTable var="v" value="#{test.list}" id="testTable1"> <h:column> <f:facet name="header"> <h:outputText value="Test value" /> </f:facet> <p:inputText value="#{v}" /> </h:column> </h:dataTable> <p:dataTable var="v" value="#{test.list}" id="testTable2"> <p:column headerText="Test value"> <h:outputText value="#{v}" /> </p:column> </p:dataTable> <p:commandButton value="Clear" actionListener="#{test.clear()}" immediate="true" update=":form:testTable :form:testTable1 :form:testTable2"/> <p:commandButton value="Update" actionListener="#{test.update()}" update=":form:testTable :form:testTable1 :form:testTable2"/> </h:form> </h:body> And java: import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.bean.ViewScoped; import javax.inject.Inject; import javax.inject.Named; @Named @ViewScoped public class Test implements Serializable { private static final long serialVersionUID = 1L; private List<String> list; @PostConstruct private void init(){ update(); } public List<String> getList() { return list; } public void setList(List<String> list) { this.list = list; } public void clear() { list = new ArrayList<String>(); } public void update() { list = new ArrayList<String>(); list.add("Item 1"); list.add("Item 2"); } } In the example above I have 3 configurations: 1. p:dataTable with p:inputText 2. h:dataTable with p:inputText 3. p:dataTable with h:outputText And 2 buttons: first clears data, second applies data Workflow: 1. Try to change data in inputTexts in p:dataTable and h:dataTable 2. Clear data of list (arrayList of string) - click "clear" button (imagine that you click cancel on form because you don't want to store data to database) 3. Load new data - click "update" button (imagine that you are openning new form with new data) Question: Why p:dataTable with p:inputText still stores manually changed data, not the loaded ones? Is there any way to force p:dataTable to behaving like h:dataTable in this case?

    Read the article

  • LINQ and paging with a DataTable - can't get Skip working?

    - by Kit Menke
    Ok so this might be a dumb question, but I can't seem to figure it out. I thought I'd try out LINQ against a DataTable. I got my query working and now I'm trying to implement some simple paging. DataTable dataTable = null; dataTable = GetAllDataTables(); var query = from r in dataTable.AsEnumerable() orderby r.Field<string>(Constants.fileName) select r; query.Skip(WPP_PAGE_SIZE * pageIndex).Take(WPP_PAGE_SIZE); My problem is that I get an error at query.Skip(...). Error 1 'System.Data.OrderedEnumerableRowCollection' does not contain a definition for 'Skip' and no extension method 'Skip' accepting a first argument of type 'System.Data.OrderedEnumerableRowCollection' could be found (are you missing a using directive or an assembly reference?) References I have: Microsoft.SharePoint System System.Core System.Data System.Data.DataSetExtensions System.Web System.Xml What am I missing?

    Read the article

  • DataTable DataRow Select String with Quotation Marks

    - by RBrattas
    Hi, My string include quotation mark; the select statement crash. vm_TEXT_string = "Hello 'French' People"; vm_DataTable_SELECT_string = "[MyField] = '" + vm_TEXT_string + "'"; DataRow[] o_DataRow_ARRAY_Found = vco_DataTable.Select (vm_DataTable_SELECT_string); I cannot use this statement: string filter = "[MyColumn]" + " LIKE '%" + SearchWord + "%'"; I found string format: DataRow[] oDataRow = oDataSet.Tables["HasDiseas"].Select ( string.Format ( "DName='{0}'", DiseasListBox.SelectedItem.ToString () ) ); Any suggestion to selecta string with quotation mark? Thank you, Rune

    Read the article

  • How to elegantly create a datatable with Django ?

    - by Inshim
    Here's a common situation that I have and wish to avoid creating tedious loops and fiddling with html tables: I have a model Movie, which is has fkeys to Director and to Genre. How can I elegantly render a simple data table that has on one axis the different Directors, on another axis the different Genres, and inside each cell the count of the movies filtered by the respective Director and Genre? Thanks!

    Read the article

  • Converting a C# DataTable instance to xml that contains HTML or binary data

    - by Wardy
    Hmmmm ... Although it works in most cases, one column has html data in it. It seems that doing this ... StringBuilder xmltarget = new StringBuilder(); XmlWriter xmlWriter = XmlWriter.Create(xmltarget); tableData.WriteXml(xmlWriter); ... doesn't identify where this html or binary data exists and wrap the data in cdata tags as it should ... Is there something i need to do to ensure the relevant checks are made and a working xml string is produced?

    Read the article

  • C# ASP.NET Update database with datatable

    - by Sir Graystar
    Scenario: I'm just trying to update my database with the changes made by the user to their information. Here is my code: SqlCommandBuilder cb = new SqlCommandBuilder(da); dt.Rows[0][2] = txtname.Text; dt.Rows[0][3] = txtinterests.Text; dt.Rows[0][4] = txtlocation.Text; da.SelectCommand = new SqlCommand(sqlcommand, conn); da.Update(dt); I know its going to be something obvious, but what have I missed? There are no errors, everything compiles correctly, but nothing happens. The record remains unchanged.

    Read the article

  • jquery datatable.min.js sorting issue?

    - by Karthik
    In my project, i am using the jquery pagination of jquery.dataTables.min.js. In that when i use ascending or descending in query, it will not displayed properly. The problem is result can be shown in form of : Sl. No. 1 10 11 12 13 | | | 19 2 3 4 5 like this, But i need the result Sl. No. 1 2 3 4 5 | | 9 10 11 12 13 This is because of jquery only. I want to know how can i clear this? But in someplace it is displayed properly and in someplace is not displayed properly.

    Read the article

  • Convert Yes/No/Null from SQL to True/False in a DataTable

    - by Scott Chamberlain
    I have a Sql Database (which I have no control over the schema) that has a Column that will have the varchar value of "Yes", "No", or it will be null. For the purpose of what I am doing null will be handled as No. I am programming in c# net 3.5 using a data table and table adapter to pull the data down. I would like to directly bind the column using a binding source to a check box I have in my program however I do not know how or where to put the logic to convert the string Yes/No/null to boolean True/False; Reading a null from the SQL server and writing back a No on a update is acceptable behavior. Any help is greatly appreciated. EDIT -- This is being developed for windows.

    Read the article

  • Strange DataTable behaviour

    - by DocSnuggles
    There´s a strange behaviour in my code which I can´t explain... I have worked arround it but I´d like to know the reason of this behaviour. My Code: If dataset.Tables.Count > 0 Then Dim rows() As DataRow = dataset.Tables(0).Select("FileID = " + fileid.ToString) For Each row As DataRow In rows... the one and only table in dataset is: 18 1 1 testpara42 19 1 2 Para2 23 2 1 Para1 24 2 2 Para42 Where the colums are: ParamID - FileID - ParaPos - Paravalue. I want do filter it so that the only rows I get are the ones with the correct fileid... the result when the selection string is "FileID = 1" is an array with 2 rows... everything is fine... but the filter string "FileID = 2" will return 0 Rows... A filter like "FileID < 1" returns 2 Rows correctly. I really cant´t explain this od behaviour, maybe one of the community does. The Table does have more entries but the Filter string just works with the "FileID = 1" selection. Excuse my bad english. Please explain my mistake to me.

    Read the article

  • Merging DataTable(s) Column by Column.

    - by Omky
    Hello All, I want to merge two or more DataTables Colum by Column. I am developing C# Windows Application. My use case is below: I have empty data grid in my application. user will drag and drop one column from available column list box into data grid. The data grid will start displaying data for that column. Now, I will drag another column into data grid and now grid should get populated data of two columns. This will repeat till user feels that he has dropped all necessary columns. What is best way to do this? Is there any performance hits with large number of rows typically 1 million? Please help. Thanks, Omky

    Read the article

  • How do you filter a view of a DataTable in .Net 3.5 sp1 using WPF c# and xaml?

    - by Tony
    I found the MSDN example code for getting the default view of a collection and adding a filter to the view, but most of it is for .Net 4.0. I'm on a team that is not currently switching to 4.0, so I don't have that option. None of the examples I found used a DataTable as the source, so I had to adapt it a little. I'm using a DataTable because the data is comming from a DB ans it's easy to populate. After trying to implement the MSDN examples, I get a "NotSupportedException" when I try to set the Filter. This is the c# code I have: protected DataTable _data = new DataTable(); protected BindingListCollectionView _filteredDataView; ... private void On_Loaded(Object sender, RoutedEventArgs e) { _filteredDataView = (BindingListCollectionView)CollectionViewSource.GetDefaultView(_data); _filteredDataView.Filter = new Predicate(MatchesCurrentSelections); // throws NotSupportedException } ... public bool MatchesCurrentSelections(object o){...} It seems that either BindingListCollectionView does not support filtering in .Net 3.5, or it just doesn't work for a DataTable. I looked at setting it up in XAML instead of the C# code, but the XAML examples use collections in resources instead of a collection that is a memberof the class, so I have no idea how to set that up. Does any one know how to filter a view to a DataTable?

    Read the article

  • JSF inner datatable not respecting rendered condition of outer table.

    - by Marc
    <h:dataTable cellpadding="0" cellspacing="0" styleClass="list_table" id="OuterItems" value="#{valueList.values}" var="item" border="0"> <h:column rendered="#{item.typeA"> <h:dataTable cellpadding="0" cellspacing="0" styleClass="list_table" id="InnerItems" value="#{item.options}" var="option" border="0"> <h:column > <h:outputText value="Option: #{option.displayValue}"/> </h:column> </h:dataTable> </h:column> <h:column rendered="#{item.typeB"> <h:dataTable cellpadding="0" cellspacing="0" styleClass="list_table" id="InnerItems" value="#{item.demands}" var="demand" border="0"> <h:column > <h:outputText value="Demand: #{demand.displayValue}"/> </h:column> </h:dataTable> </h:column> </h:dataTable> public class Item{ ... public boolean isTypeA(){ return this instanceof TypeA; } public boolean isTypeB(){ return this instanceof TypeB; } ... } public class typeA extends Item(){ ... public List getOptions(){ .... } ... } public class typeB extends Item(){ ... public List getDemands(){ ... } .... } I'm having an issue with JSF. I've abstracted the problem out here, and I'm hoping someone can help me understand how what I'm doing fails. I'm looping over a list of Items. These Items are actually instances of the subclasses TypeA and TypeB. For Type A, I want to display the options, for Type B I want to display the demands. When rendering the page for the first time, this works fine. However, when I post back to the page for some action, I get an error: [3/26/10 12:52:32:781 EST] 0000008c SystemErr R javax.faces.FacesException: Error getting property 'options' from bean of type TypeB at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:89) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java(Compiled Code)) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91) at com.ibm.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:193) My grasp on the JSF lifecyle is very rough. At this point, i understand there is an error in the ApplyRequestValues Phases which is very early and so the previous state is restored and nothing changes. What I don't understand is that in order to fufill the condition for rendering "item.typeA" that object has to be an instance of TypeA. But here, it looks like that object passed the condition even though it was an instance of TypeB. It is like it is evaluating the inner dataTable (InnerItems) before evaluating the outer (outerItems). My working assumption is that I just don't understand how/when the rendered attribute is actually evaluated.

    Read the article

  • Object Reference Error filling a datarow

    - by JPJedi
    This is the code: Dim dr() As DataRow = DataSet.Tables("TableName").Select("EVENTNAME = '" & name & "'") I get an "Object reference not set to an instance of an object." Error when this line is executed. It is looping through a list of selected items in a listbox. I think it has to do with how I have the datarow declared because I can look at the name and I see it ok and I also do a null check on the name before I use it. Visual Studio 2008, VB.NET. Any ideas? Yep it was a wrong table name. I guess after looking at the code for 8 hours that minor detail I just wasn't thinking to check. Thanks!

    Read the article

  • DataTable to Generic List Conversion

    using System;using System.Collections.Generic;using System.Linq;using System.Data;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { DataTable table = new DataTable { Columns = { {"Number", typeof(int)}, {"Name", typeof(string)} } }; //Just adding few test rows to datatable. for (int i = 1; i <= 5; i++) { table.Rows.Add(i, "Name" + i); } var returnList = from row in table.AsEnumerable() select new MyObject { Number = row.Field<int>("Number"), Name = row.Field<String>("Name") }; //Displaying converted collection foreach (MyObject item in returnList) { Console.WriteLine("{0}\t{1}", item.Number, item.Name); } } } class MyObject { public int Number { get; set; } public String Name { get; set; } }} span.fullpost {display:none;}

    Read the article

  • How to insert a DataTable with existing Key to a SQL Server Table.

    - by user296575
    I am working with VB.NET.. i have a DataTable called "QUESTION", containing 3 fields: QuestionNumber (unique integer key) QuestionText QuestionType In my SQL Server database I created a Table called "QUESTION" with the same fields. QuestionNumber is defined as integer unique key, auto increment Now, when i make a bulk copy to insert the DataTable into the SQL Server, the database overwrites my QuestionNumber from the DataTable and generates new ones (starting from 1 increment 1). How do i have to change my database setup, that the original QuestionNumbers are copied into the database?

    Read the article

  • How to convert a DataTable to a string in C#?

    - by Mark Allison
    Hi there, I'm using Visual Studio 2005 and have a DataTable with two columns and some rows that I want to output to the console. I hoped there would be something like: DataTable results = MyMethod.GetResults(); Console.WriteLine (results.ToString()); What's the best way (i.e. least amount of coding from me) to convert a simple DataTable to a string? Thanks, Mark.

    Read the article

  • How to efficiently convert DataSet.Tables to List<DataTable>?

    - by Soenhay
    I see many posts about converting the table(s) in a DataSet to a list of DataRows or other row data but I was unable to find anything about this question. This is what I came up with using in .Net 3.0: internal static List<DataTable> DataSetToList(DataSet ds) { List<DataTable> result = new List<DataTable>(); foreach (DataTable dtbl in ds.Tables) { result.Add(dtbl); } return result; } Is there a better way, excluding an extension method? Thanks

    Read the article

  • Is it possible to do live events in YUI, similar to jQuery's live events?

    - by eculver
    It doesn't currently seem as though there is a way to do live events in YUI similar to jQuery: http://api.jquery.com/live/ It sure would be nice if something like: function handleClick(e) { // click! } YUI().use('node-base', function(Y) { Y.on("click", handleClick, ".foo"); }); caused handleClick to be fired when a node with the "foo" class was clicked on after being dynamically added to the DOM and sometime after the Y.on was evaluated. I feel like live events are one of jQuery's killer features that YUI lacks.

    Read the article

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