I have a .csv file (words.csv) containing 5000 words seperated by commas. Most of the strings are repeated values.
Can I use LINQ to do the following:
A. group common words together and show count of repeated words
so if apple has been repeated 5 times and banana 3 times..it should display as
apple - 5
banana - 3
and so on
B. Creat...
Hi every one!
I am using LINQ to call a function named "GetTabMenuTheme", I dragged it in the Database Model to generate the function like this:
[Function(Name="dbo.GetTabMenuTheme", IsComposable=true)]
public string GetTabMenuTheme([Parameter(DbType="NVarChar(MAX)")] string state)
{
return ((string)(this.ExecuteMethodCall(this, ((...
I've got the following classes:
public class SupplierCategory : IEquatable<SupplierCategory>
{
public string Name { get; set; }
public string Parent { get; set; }
#region IEquatable<SupplierCategory> Members
public bool Equals(SupplierCategory other)
{
return this.Name == other.Name && this.Parent == other....
Why is this thing not working?
[Database(Name="Relationships_Test")]
[Table(Name = "Order")]
public class Order
{
[Column(Name="ID", IsPrimaryKey=true)]
public int ID { get; set; }
[Column(Name = "OrderDate")]
public DateTime OrderDate { get; set; }
public void Save()
{
DataContext dc = new DataContext(@"Data Source=.\sqlexpre...
I have no idea how to convert this SQL statement to LINQ that uses OUTER APPLY and TOP. Can somebody give an idea how deal with it. Thanks!
SELECT Cust.CustomerName, Ord.OnlineOrderTitle, Pro.ProductTitle,
Pic.PictureFilename, PCom.PictureCommentText, Ord.OnlineOrderDateAdded
FROM Customer as Cust
OUTER APPLY
(SELECT * FROM OnlineO...
Edited
Solution using or rather than union !
It seems there is a problem with linq2sql w.r.t selecting a relation post a UNION
msdn's social forums also indicate it as so
Intent
To get WCtegories & WPBands having items ("W") and each item with either a price or an offer specified
Sql just works fine but linq is bugging out with erro...
When i have a list
IList<int> list = new List<int>();
list.Add(100);
list.Add(200);
list.Add(300);
list.Add(400);
list.Add(500);
What is the way to extract a pairs
Example : List elements {100,200,300,400,500}
Expected Pair : { {100,200} ,{200,300} ,{300,400} ,{400,500} }
...
I have 2 important date fields in db.
startTime and goTime
I like to create custom query in which one parameter may be empty, see my example
public List<Type> GetAll( DateTime startTime, DateTime goTime )
{
List<Type> getResultBetween =
(from i in DB.TABLENAME
where i.startTime >= startTime && i.goTime == ANYTHING
select i...
Is it possible to get list after Session.Close as below?
var bundles = session.Linq<Bundle>();
session.Close();
var bs = bundles.ToList();
I get error, is there a different syntax for that?
...
solved: IstBestellwert = grouped.Sum(o => (double)o.SollMenge * (double)o.Preis) works
My SQL Statment
SELECT ABId, SUM(Preis * IstMenge) AS IstBestellwert, SUM(Preis * SollMenge) AS SollBestellwert
FROM vChainStoreOrderingDetails
GROUP BY ABId, FilialId
HAVING
(ABId = 10) AND (FilialId IN (8, 140))
...
I am setting two values based on two different conditions inside for each. Is it possible to implement the below in LINQ ?
foreach(Customer cust in Customers)
{
If(Condition 1)
condtion1Var =true;
If(Condition2 )
condition2Var =true;
}
...
In my repository implementation I can run the following query using a lambda expression:
public IList<User> GetUsersFromCountry(string)
{
return _UserRepository.Where(x => x.Country == "Sweden").ToList();
}
So far so good, simple stuff. However, I'm having difficulties to write a lambda expression against a neste...
I am really missing something with anonymous types, because I can't figure out what to do with the Combobox.SelectedItem property.
Here's the code that populates the combobox, and it works just fine
var stocks = from st in brdc.tb_dStocks
join su in brdc.tb_rStockUsers on st.StockID equals su.StockID
...
Hi there,
I have a table called TableA whch has a foreign key from TableB and a one to many relationship to TableB
I want to do:
var v = Context.TableASet
.Include("TableB")
.Where(x => x.TableB.Col1 == 123)
But when I do x.TableB. I don't have the Col1 option. this is because TableB has a one to many...
The query below gets all customers and the products they order. There are multiple pictures per product, so the query returns duplicate rows. I only want one of the pictures to prevent this duplication. The pictures have a rank order. So, I need to sort the pictures and take the one with highest rank and join that to products. How ca...
Hi,
How to extract method name and namespace from this xml using LINQ to XML?
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/add...
In my data model I have a fairly common division between my objects/tables/data:
"Transactional" entities that represent the work that is being done by the system. These entities are created by the system and are only important in specific contexts. They are regularly created on the fly. (Aside: Is there a proper name for this type of ...
This should be easy.
I want to check whether two list are the same in that they contain all the same elements or not, orders not important.
Duplicated elements are considered equal, i.e.e, new[]{1,2,2} is the same with new[]{2,1}
...
I need to select distinct rows from Textfile display below.
TextFile
123| one| two| three <br/>
124| one| two| four <br/>
125| one |two| three <br/>
Output should like this
123| one| two| three <br/>
124| one| two| four <br/>
OR
124| one| two| four <br/>
125| one |two| three <br/>
I am using this code to work out this ...
I have a number of LINQ to SQL tables with the same fields (CreatedDate and CreatedUser).
I would like a usercontrol to display the values from these fields if the data is passed in as an IQueryable<T> or IEnumerable<T>
For example:
public void UpdateStatus<T>(IQueryable<T> data)
{
DateTime? theDate = data.Single().CreatedDate; /...