Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Select * from table
where Numero_Operacion in
(
Select Numero_Operacion from table
group by Numero_Operacion
having count(Numero_Operacion)>1
)
THANKS!
It would be something like this
<Table>.GroupBy(x => x.Numero_Operacion)
.Where(x => x.Count() > 1)
.SelectMany(x => x)
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
how to detect double-key board (like double key-Enter) With ReactiveUI
How about this:
doubleEnter = someWindow.Events().KeyUp
.Where(x => x.EventArgs.Key == Key.Enter)
.Buffer(TimeSpan.FromMilliseconds(650), RxApp.MainThreadScheduler)
.Where(x => x.Length > 1);
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Currently, I have a List<object> like this: List<USER>.
In User class, I have column named UserName.
I want to retrieve this column to List<string>.
How can it work without using foreach for List<USER>?
Thanks.
You can use LINQ:
List<string> userNames = users.Select(u => u.UserName).ToList();
In addition to Tim Schmelter post:
For casting IEnumerable<object> to IEnumerable<USER> you may use Cast<T> or OfType<T> method.
This can be written as follows:
var userNames = users.Cast<USER>.Select(u => u.UserName).ToList();
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I used wcf service to work directly to database.
And the result I got as this format: DIA_User[]
I can use linq for this as select, find,... but I dont know how to convert to List<DIA_User>
Please advise.
Thank you very much.
Just use ToList() method, which is an extension method on IEnumerable<>
DIA_User[] x = new DIA_User[] {};
List<DIA_User> y = x.ToList();
List<DIA_USER> users = new List<DIA_USER>(diaUserArray);
var arrayUser = new DIA_User[]();
var listUsers = arrayUser.ToList();
BTW, you can configure your WCF service to send Lists instead of Arrays.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
select cast(' ' as varchar(1000)) as myfield, otherfield
from tab1;
I need to convert above SQL to Linq-To-Sql.
Maybe:
from item in dataContext.Items
select new { MyField = "", Item = item };
Unfortunately, AMAIK, there is no way to declare * in projection in LINQ. Thus to have all other fields alongside your MyField field, you should write them all.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Could anyone please suggest, I have a datatable with 100 records and want to update any 1 specific record based on id.
Here is an example, maybe it helps even if your reqirement is not that clear:
DataRow row = tableWith100Rows.AsEnumerable()
.FirstOrDefault(r => r.Field<int>("ID") == 4711);
if(row != null)
row.SetField("ColumnToUpdate", "new value");