Dear all,
How to add data to dictonary from xml file
scenerio:
I've declared a dictonary like
Dictonary<string,string> SampleDict=new Dictonary<string,string>();
and my xml file is like
<Data>
<Element ValOne="1" ValTwo="0" />
<Element ValOne="2" ValTwo="2" />
<Element ValOne="3" ValTwo="4" />
<Element ValOne="4" Val...
hi i m using Linq & C# and i want to filter my data as this syntax in Sql
Syntax in sql is
I hav one table name Customer in which name is field
'Select name from customer where name like 'C%''
can u help to solve this code in Linq
...
hello guys!
i have a table with hierarchical structure. like this:
and table data shown here:
this strategy gives me the ability to have unbounded categories and sub-categories.
i use ASP.net 3.5 SP1 and LINQ and MSSQL Server2005. How to convert it to XML? I can Do it with Dataset Object and ".GetXML()" method. but how to implement ...
Please excuse my stupidity, I tend to find the traversing XML overly complicated.
I am using ASP.NET in VB.
I have an XML document which contains all the details of staff in my company...
<staff>
<staffName>Test Staff</staffName>
<staffTitle>Slave</staffTitle>
<staffDepartmentName>Finance</staffDepartmentName>
<staffOf...
Imagine to have a table defined as
CREATE TABLE [dbo].[Price](
[ID] [int] NOT NULL,
[StartDate] [datetime] NOT NULL,
[Price] [int] NOT NULL
)
where ID is the identifier of an action having a certain Price. This price can be updated if necessary by adding a new line with the same ID, different Price, and a more recent date....
When I run this snippet of code:
string[] words = new string[] { "foo", "bar" };
var results = from row in Assets select row;
foreach (string word in words)
{
results = results.Where(row => row.Name.Contains(word));
}
I get this SQL:
-- Region Parameters
DECLARE @p0 VarChar(5) = '%bar%'
DECLARE @p1 VarChar(5) = '%bar%'
-- EndRegi...
How to dynamically generate LINQ query:
int[] IDArray = {55, 36};
public IQueryable<ContactListView> FindAllContacts(int loggedUserID, int[] IDArray)
{
var result = (
from contact in db.Contacts
//Start of dynamic part...
where
contact.UserID == loggedUserID
...
Hi all,
I have a silly question. I would like to know if there is performance deference in these two quries:
var cObject = from cust in entities.Customer
where cust.id == cid
select cust;
and
var cObject = entities.Customer.First( c=> c.id == cid);
My query return only one record as I am querying with the prima...
Is there a way to use a LINQ expression to request a Count query from the Netflix oData service in Silverlight 4?
The Netflix documentation shows that you can return counts by appending $count to a request for a collection, but a URL like this:
http://netflix.cloudapp.net/Catalog/Genres/$count
Is not generated from an expression like...
What is Linq actually doing?
...
I have 3 tables. A primary EmploymentPlan table with PK GUID EmploymentPlanID and 2 FK's GUID PrevocServicesID & GUID JobDevelopmentServicesID. There are of course other fields, almost exclusively varchar(). Then the 2 secondary tables with the corresponding PK to the primary's FK's.
I am trying to write the LINQ INSERT Method and am...
With a DataContext and a blank file-based database that already exists, is it possible to write the Data Context classes (i.e. the ones I added to the designer) to create the db schema?
With a data context I only see the abilities to either:
create a new database file and have its structure created at the same time,
or to populate...
How would I translate the following SQL query in to a comparable LINQ query?
select * from Dept
where Id not in (
Select Id
from Employee
where Salary > 100);
...
I modified my data source in my LINQ-to-SQL class (by the old delete and drag back in method), and was surprised to see the INotifyPropertyChanging & INotifyPropertyChanged interfaces no longer implemented in the generated classes (MyDb.designer.cs).
The methods for the individual fields went from looking like this...
[Column(Storage="...
Please do not give me a full working example, I want to know how this is done rather than to get some code I can copy paste
This is the query I need, and can't for the life of me create it in LINQ.
SELECT * FROM
dbo.Schedules s, dbo.Videos v
WHERE s.VideoID = v.ID
AND s.ID IN
(
SELECT MAX(ID) FROM dbo.Schedules
WHERE ChannelID...
I have an abstract class called Grouping. I have a subclass called GroupingNNA.
public class GroupingNNA : Grouping {
// blah blah blah
}
I have a List that contains items of type GroupingNNA, but is actually declared to contain items of type Grouping.
List<Grouping> lstGroupings = new List<Grouping>();
lstGroupings.Add(
new Grou...
I am having a bear of a time getting this to work. I have a List(Of MyItem) called Items that have a OrderId property on them. From those items, I want to create a list of Orders. Some items will have the same OrderId so I want to try to group by OrderId. I then want to sort by date. Here's what I have so far:
Public ReadOnly Property A...
In LINQPad is there any way to access either the SYSOBJECTS table or the various INFORMATION_SCHEMA.xxx views using LINQ?
I spend a lot of time searching through our huge company database for partial names as there are too many tables and Stored Procedures to remember the names of them all.
I know I can enter and run SQL in LINQPad but...
How does OfType() Work?
I read this link about what's going on but how exactly does the LINQ provider know how to get all objects matching the specified type. I know the IQueryable<T> "chains" up requests and then evaluates when GetEnumerator() is called (right?).
Specifically I want to know how does the framework quickly do type comp...
I have a List that has various derived classes. I may have something like this:
List<BaseClass> list = new List<BaseClass>() {
new Class1(),
new Class2(1),
new Class3(),
new Class2(2),
new Class4()
};
I am trying to use LINQ to semi-sort the list so that the natural order is maintained EXCEPT for Class2. All Class2 instanc...