Search Results

Search found 6048 results on 242 pages for 'linq to dataset'.

Page 2/242 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Dataset -> XML Document - Load DataSet into an XML Document - C#.Net

    - by NLV
    Hello I'm trying to read a dataset as xml and load it into an XML Document. XmlDocument contractHistoryXMLSchemaDoc = new XmlDocument(); using (MemoryStream ms = new MemoryStream()) { //XmlWriterSettings xmlWSettings = new XmlWriterSettings(); //xmlWSettings.ConformanceLevel = ConformanceLevel.Auto; using (XmlWriter xmlW = XmlWriter.Create(ms)) { xmlW.WriteStartDocument(); dsContract.WriteXmlSchema(xmlW); xmlW.WriteEndDocument(); xmlW.Close(); using (XmlReader xmlR = XmlReader.Create(ms)) { contractHistoryXMLSchemaDoc.Load(xmlR); } } } But I'm getting the error - "Root Element Missing". Any ideas? Update When i do xmlR.ReadInnerXML() it is empty. Does anyone know why? NLV

    Read the article

  • Use Any() and Count() in Dynamic Linq

    - by ArpanDesai
    I am trying to write dynamic Linq Library query to fetch record on condition, Customers who has order count is greater than 3 and ShipVia field equal 2. Below is my syntax what i have tried. object[] objArr = new object[10]; objArr[0] = 1; IQueryable<Customer> test = db.Customers.Where("Orders.Count(ShipVia=2)", objArr); and IQueryable<Customer> test = db.Customers.Where("Orders.Any(ShipVia=2).Count()", objArr); But both are not working. In second query Any returns true so it won't work with Count. Suggest me a way to implement this.

    Read the article

  • return from a linq where statement

    - by Vaccano
    I have the following link function MyLinqToSQLTable.Where(x => x.objectID == paramObjectID).ToList(); I most of the time you can change a linq call to be several lines by adding curly brackets around the method body. Like this: MyLinqToSQLTable.Where(x => { x.objectID == paramObjectID; }).ToList(); Problem is the implied return that was there when I just did a Boolean compare is now not done. Return (x.objectID == paramObjectID); is not accepted either. How do do this? can I do this? NOTE: I know that I can add another where clause if needed. But I would still like to know the answer to this.

    Read the article

  • User DataSet Editor

    - by Steven
    When the user clicks an "Edit" button on my form, I want a box to come up which allows the user to edit a DataTable in a strongly-typed DataSet. What's the best way to do this?

    Read the article

  • Parse XML tree with no id using LINQ to XML

    - by Danny
    Requirement I want to read a XML tree, fill my objects with encountered attributes and after every run a method (insert it into my db). The amount of parents is not specified, also the order is not specified, it could be, address-death-death-address-address for example Input file Overview: <Root> <Element> <Element2> <Parent> <Child> <Grandchild> <Grandchild> </Child> </Parent> </Element2> </Element1> </Root> Full example: <?xml version="1.0" encoding="utf-8" ?> <Root> <Element1> <Element2> <Parent> <Child> <Grandchild> <number>01</number> <name>Person</name> <Rows> <Row> <number>0110</number> <name>ID</name> <value>123456789</value> </Row> </Rows> </Grandchild> <Grandchild> <number>08</number> <name>Address</name> <Rows> <Row> <number>1110</number> <name>street</name> <value>first aveneu</value> </Row> <Row> <number>1120</number> <name>streetnumber</name> <value>345</value> </Row> <Row> <number>1130</number> <name>zip</name> <value>2938PS</value> </Row> <Row> <number>1160</number> <name>country</name> <value>Germany</value> </Row> </Rows> </Grandchild> </Child> </Parent> <Parent> <Child> <Grandchild> <number>01</number> <name>Person</name> <Rows> <Row> <number>0110</number> <name>ID</name> <value>987654321</value> </Row> </Rows> </Grandchild> <Grandchild> <number>06</number> <name>Death</name> <Rows> <Row> <number>0810</number> <name>date</name> <value>2012-01-03</value> </Row> <Row> <number>0820</number> <name>placeOfDeath</name> <value>attic</value> </Row> <Row> <number>0830</number> <name>funeral</name> <value>burrial</value> </Row> </Rows> </Grandchild> </Child> </Parent> </Element2> </Element1> </Root> Desired result After encounter of parent determine type of grandchild (number 6 is death number 8 is address) Every parent has ALWAYS grandchild number 1 'Person', the second grandchild is either death or address. reading first parent Person person = new Person(); person.ID = value; <--- filled with 123456789 person.street = value; <--- filled with first aveneu person.streetnumber = value; <--- filled with 345 person.zip = value; <--- filled with 2938PS person.country = value; <--- filled with germany person.DoMethod(); // inserts the value in db Continue reading next parent. Person person = new Person(); person.ID = value; <--- filled with 987654321 person.date = value; <--- filled with 2012-01-03 person.placeOfDeath = value; <--- filled with attic person.funeral = value; <--- filled with burrial person.DoMethod(); // insert the values in db Continue reading till no parents found EDIT: how do I target the name element of the second grandchild for every child? Like address or death Code/Credit I got no further then this, with help of Daniel Hilgarth: Linq to XML (C#) parse XML tree with no attributes/id to object The XML tree has changed, and I am really stuck.. in the meantime I try to post new working code...

    Read the article

  • Why I am getting Null from this statement. Query Syntax in C#

    - by Shantanu Gupta
    This is not working. Returns Null to dept_list. var dept_list = ((from map in DtMapGuestDepartment.AsEnumerable() where map.Field<Nullable<long>>("Guest_Id") == 174 select map.Field<Nullable<long>>("Department_id")).Distinct())as IEnumerable<DataRow>; DataTable dt = dept_list.CopyToDataTable(); //dept_list comes null here This works as desired. var dept_list = from map in DtMapGuestDepartment.AsEnumerable() where map.Field<Nullable<long>>("Guest_Id") == 174 select map; DataTable dt = dept_list.CopyToDataTable(); //when used like this runs correct. What mistake is being done by me here. ?

    Read the article

  • How to differentiate between to similer fields in Linq Join tables

    - by Azhar
    How to differentiate between to select new fields e.g. Description c.Description and lt.Description DataTable lDt = new DataTable(); try { lDt.Columns.Add(new DataColumn("AreaTypeID", typeof(Int32))); lDt.Columns.Add(new DataColumn("CategoryRef", typeof(Int32))); lDt.Columns.Add(new DataColumn("Description", typeof(String))); lDt.Columns.Add(new DataColumn("CatDescription", typeof(String))); EzEagleDBDataContext lDc = new EzEagleDBDataContext(); var lAreaType = (from lt in lDc.tbl_AreaTypes join c in lDc.tbl_AreaCategories on lt.CategoryRef equals c.CategoryID where lt.AreaTypeID== pTypeId select new { lt.AreaTypeID, lt.Description, lt.CategoryRef, c.Description }).ToArray(); for (int j = 0; j< lAreaType.Count; j++) { DataRow dr = lDt.NewRow(); dr["AreaTypeID"] = lAreaType[j].LandmarkTypeID; dr["CategoryRef"] = lAreaType[j].CategoryRef; dr["Description"] = lAreaType[j].Description; dr["CatDescription"] = lAreaType[j].; lDt.Rows.Add(dr); } } catch (Exception ex) { }

    Read the article

  • How to differentiate between two similar fields in Linq Join tables

    - by Azhar
    How to differentiate between two select new fields e.g. Description c.Description and lt.Description DataTable lDt = new DataTable(); try { lDt.Columns.Add(new DataColumn("AreaTypeID", typeof(Int32))); lDt.Columns.Add(new DataColumn("CategoryRef", typeof(Int32))); lDt.Columns.Add(new DataColumn("Description", typeof(String))); lDt.Columns.Add(new DataColumn("CatDescription", typeof(String))); EzEagleDBDataContext lDc = new EzEagleDBDataContext(); var lAreaType = (from lt in lDc.tbl_AreaTypes join c in lDc.tbl_AreaCategories on lt.CategoryRef equals c.CategoryID where lt.AreaTypeID== pTypeId select new { lt.AreaTypeID, lt.Description, lt.CategoryRef, c.Description }).ToArray(); for (int j = 0; j< lAreaType.Count; j++) { DataRow dr = lDt.NewRow(); dr["AreaTypeID"] = lAreaType[j].LandmarkTypeID; dr["CategoryRef"] = lAreaType[j].CategoryRef; dr["Description"] = lAreaType[j].Description; dr["CatDescription"] = lAreaType[j].; lDt.Rows.Add(dr); } } catch (Exception ex) { }

    Read the article

  • What is the difference between "LINQ to Entities", "LINQ to SQL" and "LINQ to Dataset".

    - by Marcel
    I've been working for quite a while now with LINQ. However, it remains a bit of a mystery what the real differences are between the mentioned flavours of LINQ. The successful answer will contain a short differentiation between them. What is the main goal of each flavor, what is the benefit, and is there a performance impact... P.S. I know that there are a lot of information sources out there, but I'm looking for a kind of a "cheat sheet" which instructs a newbie where to head for a specific goal.

    Read the article

  • What is the differnce between "LINQ to Entities", "LINQ to SQL" and "LINQ to Dataset".

    - by Marcel
    Hi all, I'm working for quite a while now with LINQ. However, it remained still a bit of a mystery what are the real differences between the mentioned flavours of LINQ. The successful answer will contain a short differentiation between them. What is the main goal if it, what is the benefit, and is there a performance impact... P.S. I know that there are a lot of information sources out there, but I look for a kind of a "cheat sheet" which instructs a newbie where to head to for a specific goal.

    Read the article

  • xml attribure in dataset

    - by raging_boner
    I want to bind Repeater control to Dataset which is filled with XML data, but i don't know how to show attributes inside repeater. Xml File: <root> <items> <item id="9" name="111111111111" description="111111245" views="1" galleryID="0" /> </items> </root> Repeater code: <asp:Repeater ID="rptrGalleries" runat="server"> <ItemTemplate> <a href='Page?id=<%#DataBinder.Eval(Container.DataItem, "id") %>'><%#DataBinder.Eval(Container.DataItem, "name") %></a> </ItemTemplate> </asp:Repeater> Codebehind: XDocument doc = XDocument.Load(Server.MapPath("~/xml/gallery.xml")); IEnumerable<XElement> items = from item in doc.Descendants("item") orderby Convert.ToDateTime(item.Attribute("lastChanges").Value) descending where int.Parse(item.Attribute("galleryID").Value) == 0 && bool.Parse(item.Attribute("visible").Value) != false select item; DataSet ds = new DataSet(); ds.ReadXml(new StringReader(doc.ToString())); rptrGalleries.DataSource = ds; rptrGalleries.DataBind(); When I compile site I receive this error: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'id'.

    Read the article

  • Visual Studio DataSet Designer Refresh Tables

    - by LnDCobra
    In visual studio datasource designer(The screen where you have all the UML Diagrams including relations) is there any way to refresh a table and its relations/foreign key constraints without refreshing the whole table? The way I am doing it at the moment is removing the table and adding it again. This adds all the relations and refreshes all fields. Also if I change a fields data type, is there a way to automatically refresh all the fields in the datasource? Again without deleting the table and adding it again. Reason for this is because some of my TableAdapters have quite a number of complex queries attached to them and when I remove the table the adapter gets removed as well including all its queries. I am using Visual Studio 2008 and connecting to a MySQL database.

    Read the article

  • Visual Studio DataSet Designer keep queries

    - by LnDCobra
    In visual studio datasource designer(The screen where you have all the UML Diagrams including relations) is there any way to refresh a table and its relations/foreign key constraints without refreshing the whole table? The way I am doing it at the moment is removing the table and adding it again. This adds all the relations and refreshes all fields. Also if I change a fields data type, is there a way to automatically refresh all the fields in the datasource? Again without deleting the table and adding it again. Reason for this is because some of my TableAdapters have quite a number of complex queries attached to them and when I remove the table the adapter gets removed as well including all its queries. I am using Visual Studio 2008 and connecting to a MySQL database.

    Read the article

  • how to get cartesian products between database and local sequences in linq?

    - by JD
    I saw this similar question here but can't figure out how to use Contains in Cartesian product desired result situation: http://stackoverflow.com/questions/1712105/linq-to-sql-exception-local-sequence-cannot-be-used-in-linq-to-sql-implementatio Let's say I have following: var a = new [] { 1, 4, 7 }; var b = new [] { 2, 5, 8 }; var test = from i in a from j in b select new { A = i, B = j, AB = string.Format("{0:00}a{1:00}b", i, j), }; foreach (var t in test) Console.Write("{0}, ", t.AB); This works great and I get a dump like so (note, I want the cartesian product): 01a02b, 01a05b, 01a08b, 04a02b, 04a05b, 04a08b, 07a02b, 07a05b, 07a08b, Now what I really want is to take this and cartesian product it again against an ID from a database table I have. But, as soon as I add in one more from clause that instead of referencing objects, references SQL table, I get an error. So, altering above to something like so where db is defined as a new DataContext (i.e., class deriving from System.Data.Linq.DataContext): var a = new [] { 1, 4, 7 }; var b = new [] { 2, 5, 8 }; var test = from symbol in db.Symbols from i in a from j in b select new { A = i, B = j, AB = string.Format("{0}{1:00}a{2:00}b", symbol.ID, i, j), }; foreach (var t in test) Console.Write("{0}, ", t.AB); The error I get is following: Local sequence cannot be used in LINQ to SQL implementations of query operators except the Contains operator Its related to not using Contains apparently but I'm unsure how Contains would be used when I don't really want to constrict the results - I want the Cartesian product for my situation. Any ideas of how to use Contains above and still yield the Cartesian product when joining database and local sequences?

    Read the article

  • Subsonic 3 LINQ vs LINQ to SQL

    - by Jamil
    Hi, I am using SQL Server 2005 in a project. I have to decide about datalayer. I would like to use LINQ in my project. I saw SubSonic 3 supporting LINQ and I also have option for LINQ to SQL, because i can have typed lists from LINQ to SQL. I am wondering what is different between LINQ to SQL and Subsoinc 3 LINQ, Which is beneficial? Thanks! JAMIL

    Read the article

  • Dynamic Linq help, different errors depending on object passed as parameter?

    - by sah302
    I have an entityDao that is inherbited by everyone of my objectDaos. I am using Dynamic Linq and trying to get some generic queries to work. I have the following code in my generic method in my EntityDao : public abstract class EntityDao<ImplementationType> where ImplementationType : Entity { public ImplementationType getOneByValueOfProperty(string getProperty, object getValue){ ImplementationType entity = null; if (getProperty != null && getValue != null) { LCFDataContext lcfdatacontext = new LCFDataContext(); //Generic LINQ Query Here entity = lcfdatacontext.GetTable<ImplementationType>().Where(getProperty + " =@0", getValue).FirstOrDefault(); //.Where(getProperty & "==" & CStr(getValue)) } //lcfdatacontext.SubmitChanges() //lcfdatacontext.Dispose() return entity; } }         Then I do the following method call in a unit test (all my objectDaos inherit entityDao): [Test] public void getOneByValueOfProperty() { Accomplishment result = accomplishmentDao.getOneByValueOfProperty("AccomplishmentType.Name", "Publication"); Assert.IsNotNull(result); } The above passes (AccomplishmentType has a relationship to accomplishment) Accomplishment result = accomplishmentDao.getOneByValueOfProperty("Description", "Can you hear me now?"); Accomplishment result = accomplishmentDao.getOneByValueOfProperty("LocalId", 4); Both of the above work Accomplishment result = accomplishmentDao.getOneByValueOfProperty("Id", New Guid("95457751-97d9-44b5-8f80-59fc2d170a4c"))       Does not work and says the following: Operator '=' incompatible with operand types 'Guid' and 'Guid Why is this happening? Guid's can't be compared? I tried == as well but same error. What's even moreso confusing is that every example of Dynamic Linq I have seen simply usings strings whether using the parameterized where predicate or this one I have commented out: //.Where(getProperty & "==" & CStr(getValue)) With or without the Cstr, many datatypes don't work with this format. I tried setting the getValue to a string instead of an object as well, but then I just get different errors (such as a multiword string would stop comparison after the first word). What am I missing to make this work with GUIDs and/or any data type? Ideally I would like to be able to just pass in a string for getValue (as I have seen for every other dynamic LINQ example) instead of the object and have it work regardless of the data Type of the column.

    Read the article

  • LINQ to SQL and missing Many to Many EntityRefs

    - by Rick Strahl
    Ran into an odd behavior today with a many to many mapping of one of my tables in LINQ to SQL. Many to many mappings aren’t transparent in LINQ to SQL and it maps the link table the same way the SQL schema has it when creating one. In other words LINQ to SQL isn’t smart about many to many mappings and just treats it like the 3 underlying tables that make up the many to many relationship. Iain Galloway has a nice blog entry about Many to Many relationships in LINQ to SQL. I can live with that – it’s not really difficult to deal with this arrangement once mapped, especially when reading data back. Writing is a little more difficult as you do have to insert into two entities for new records, but nothing that can’t be handled in a small business object method with a few lines of code. When I created a database I’ve been using to experiment around with various different OR/Ms recently I found that for some reason LINQ to SQL was completely failing to map even to the linking table. As it turns out there’s a good reason why it fails, can you spot it below? (read on :-}) Here is the original database layout: There’s an items table, a category table and a link table that holds only the foreign keys to the Items and Category tables for a typical M->M relationship. When these three tables are imported into the model the *look* correct – I do get the relationships added (after modifying the entity names to strip the prefix): The relationship looks perfectly fine, both in the designer as well as in the XML document: <Table Name="dbo.wws_Item_Categories" Member="ItemCategories"> <Type Name="ItemCategory"> <Column Name="ItemId" Type="System.Guid" DbType="uniqueidentifier NOT NULL" CanBeNull="false" /> <Column Name="CategoryId" Type="System.Guid" DbType="uniqueidentifier NOT NULL" CanBeNull="false" /> <Association Name="ItemCategory_Category" Member="Categories" ThisKey="CategoryId" OtherKey="Id" Type="Category" /> <Association Name="Item_ItemCategory" Member="Item" ThisKey="ItemId" OtherKey="Id" Type="Item" IsForeignKey="true" /> </Type> </Table> <Table Name="dbo.wws_Categories" Member="Categories"> <Type Name="Category"> <Column Name="Id" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> <Column Name="ParentId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> <Column Name="CategoryName" Type="System.String" DbType="NVarChar(150)" CanBeNull="true" /> <Column Name="CategoryDescription" Type="System.String" DbType="NVarChar(MAX)" CanBeNull="true" /> <Column Name="tstamp" AccessModifier="Internal" Type="System.Data.Linq.Binary" DbType="rowversion" CanBeNull="true" IsVersion="true" /> <Association Name="ItemCategory_Category" Member="ItemCategory" ThisKey="Id" OtherKey="CategoryId" Type="ItemCategory" IsForeignKey="true" /> </Type> </Table> However when looking at the code generated these navigation properties (also on Item) are completely missing: [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.wws_Item_Categories")] [global::System.Runtime.Serialization.DataContractAttribute()] public partial class ItemCategory : Westwind.BusinessFramework.EntityBase { private System.Guid _ItemId; private System.Guid _CategoryId; public ItemCategory() { } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ItemId", DbType="uniqueidentifier NOT NULL")] [global::System.Runtime.Serialization.DataMemberAttribute(Order=1)] public System.Guid ItemId { get { return this._ItemId; } set { if ((this._ItemId != value)) { this._ItemId = value; } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CategoryId", DbType="uniqueidentifier NOT NULL")] [global::System.Runtime.Serialization.DataMemberAttribute(Order=2)] public System.Guid CategoryId { get { return this._CategoryId; } set { if ((this._CategoryId != value)) { this._CategoryId = value; } } } } Notice that the Item and Category association properties which should be EntityRef properties are completely missing. They’re there in the model, but the generated code – not so much. So what’s the problem here? The problem – it appears – is that LINQ to SQL requires primary keys on all entities it tracks. In order to support tracking – even of the link table entity – the link table requires a primary key. Real obvious ain’t it, especially since the designer happily lets you import the table and even shows the relationship and implicitly the related properties. Adding an Id field as a Pk to the database and then importing results in this model layout: which properly generates the Item and Category properties into the link entity. It’s ironic that LINQ to SQL *requires* the PK in the middle – the Entity Framework requires that a link table have *only* the two foreign key fields in a table in order to recognize a many to many relation. EF actually handles the M->M relation directly without the intermediate link entity unlike LINQ to SQL. [updated from comments – 12/24/2009] Another approach is to set up both ItemId and CategoryId in the database which shows up in LINQ to SQL like this: This also work in creating the Category and Item fields in the ItemCategory entity. Ultimately this is probably the best approach as it also guarantees uniqueness of the keys and so helps in database integrity. It took me a while to figure out WTF was going on here – lulled by the designer to think that the properties should be when they were not. It’s actually a well documented feature of L2S that each entity in the model requires a Pk but of course that’s easy to miss when the model viewer shows it to you and even the underlying XML model shows the Associations properly. This is one of the issue with L2S of course – you have to play by its rules and once you hit one of those rules there’s no way around them – you’re stuck with what it requires which in this case meant changing the database.© Rick Strahl, West Wind Technologies, 2005-2010Posted in ADO.NET  LINQ  

    Read the article

  • DataSet does not support System.Nullable<>

    - by a_m0d
    I'm trying to set the DataSource for a Crystal Reports report, but I've run into a few problems. I've been following a guide written by Mohammad Mahdi Ramezanpour, and have managed to get all the way to the last part now (setting the DataSource). However, I have a problem that Mohammad does not seem to have - when I pass the results of my query to the report, I end up with the following exception: DataSet does not support System.Nullable< This is the query I am using: public IQueryable<Part> GetPartsToDisplayOnStockReport() { return from part in db.Parts where part.showOnStockReport == true select part; } and the way I pass it to the Report: public ActionResult ViewStockReport() { StockReport stockReport = new StockReport(); var parts = ordersRepository.GetPartsToDisplayOnStockReport().ToList(); stockReport.SetDataSource(parts); Stream stream = stockReport.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); } I have also tried changing my query to this code, in the hope that it would fix my problem: return (from part in db.Parts where part.showOnStockReport == true select part) ?? db.Parts.DefaultIfEmpty(); but it still complained about the same problem. How can I pass the results of this query to my report, to use it as a data source? Also, if each of my Parts object contains other objects / collections of other objects, will I be able to reference them in the report with a datasource like this?

    Read the article

  • LINQ to SQL or Entities, at this point?

    - by orlon
    I'm a bit late to the game and have decided to spend some spare time learning LINQ. As an exercise, I'm going to rewrite a WebForms app in MVC 2 (which is also new to me). I managed to find a few topics regarding LINQ here (http://stackoverflow.com/questions/16322/learning-about-linq, http://stackoverflow.com/questions/8050/beginners-guide-to-linq, http://stackoverflow.com/questions/252683/is-linq-to-sql-doa), which brought the concern of Entities vs SQL to my attention. The threads are all over a year old however, and I can't seem to find any definitive information on which ORM is preferable. Is Entities more or less LINQ to SQL 2.0 at this point? Is it still more difficult to use? Is there any reason to use LINQ to SQL, or should I just jump into Entities? The applications I write at my present employer have a lengthy lifecycle (~10 years), so I'm trying to pick the best technology available.

    Read the article

  • Using Linq to filter a ComboBox.DataSource ?

    - by Pesche Helfer
    Hi board, in another topic, I've stumbled over this very elegant solution by Darin Dimitrov to filter the DataSource of one ComboBox with the selection of another ComboBox: how to filter combobox in combobox using c# combo2.DataSource = ((IEnumerable<string>)c.DataSource) .Where(x => x == (string)combo1.SelectedValue); I would like to do a similar thing, but intead of filtering by a second combobox, I would like to filter by the text of a TextBox. (Basically, instead of choosing from a second ComboBox, the user simply enters his filter in to a TextBox). However, it turned out to be not as straight forward as I had hoped it would be. I tried stuff as the following, but failed miserably: cbWohndresse.DataSource = ((IEnumerable<DataSet>)ds) .Where(x => x.Tables["Adresse"].Select("AdrLabel LIKE '%TEST%'")); cbWohndresse.DisplayMember = "Adresse.AdrLabel"; cbWohndresse.ValueMember = "Adresse.adress_id"; ds is the DataSet which I would like to use as filtered DataSource. "Adresse" is one DataTable in this DataSet. It contains a DataColumn "AdrLabel". Now I would like to display only those "AdrLabel", which contain the string from the user input. (Currently, %TEST% replaces the textbox.text.) The above code fails because the lambda expression does not return Bool. But I am sure, there are also other problems (which type should I use for IEnumerable? Now it's DataSet, but Darin used String. But how could I convert a DataSet to a string? Yes, I am as much newbyish as it gets, my experience is "void", and publicly so. So please forgive me my rather stupid questions. Your help is greatly appreciated, because I can't solve this on my own (tried hard already). Thank you very much! Pesche P.S. I am only using Linq to achieve an uncomplicated filter for the ComboBox (avoiding a View). The rest is not based on Linq, but on oldstyle Ado.NET (ds is filled by an SqlDataAdapter), if that's of any importance.

    Read the article

  • Mixing Silverlight-Specific System.Xml.Linq dll with Non-Silverlight System.Xml.Linq dll

    - by programatique
    I have a Logic layer that references Silverlight's System.Xml.Linq dll and a GUI that is in WPF (hence using the non-Silverlight System.Xml.Linq dll). When I attempt to pass an XElement from GUI project to a method in the Logic project, I am getting (basically) "XElement is not of type XElement" errors. To complicate matter, I am unable to edit the Logic layer project. The Non-Silverlight DLL is at: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll THe Silverlight DLL is at: C:\Program Files (x86)\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Xml.Linq.dll I am new to C# but I'm fairly sure my issue is that I am referencing different DLL's to access the System.Xml.Linq namespace. I attempted to replace my non-Silverlight System.Xml.Linq.dll with the Silverlight's System.Xml.Linq.dll, but received assembly errors. Is there any way to resolve this short of scrapping my WPF GUI project and creating a Silverlight project?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >