29 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for ddanbe

I have a `List<double> MyList` something looking like this: 4.75/1.01/5.66/NaN/42.42/3.33 I’d like to get the minimum value of 1.01 out of it, but I get d = NaN when doing `double d = MyList.Min();` Tried, after some long internet strolls, something with LINQ to no avail. Some LINQ afictionados around …

Member Avatar for ddanbe
0
256
Member Avatar for VIPER5646

Hi all I'm new using LinQ. Im having Specified Cast not Valid in this Function. Hope someone let me know what I'm doing wrong. this is the Function Private Function GroupedBy() As DataTable Dim Sales As New ds_Sales_OELI Dim dt As DataTable = Sales.Not_SCheduled GroupedBy = New DataTable Dim dr …

Member Avatar for VIPER5646
0
1K
Member Avatar for PerplexedB

I have this Linq expression that works well. What is the right approach to test if it has returned anything? internal static void getCreditNotes(string invoiceId, out DataTable creditNotes,out double total) { total = 0; creditNotes = new DataTable(); var q = dt.AsEnumerable(). Where(r => (string) r["invoiceId"] == invoiceId && (string) …

Member Avatar for PerplexedB
0
213
Member Avatar for flebber

I am doing ex4 from the fundamentals of C#. But I cannot solve the problem. I am unable to slice the array correctly and instead just endup with System.int32[] Simply all I am supposed to do is find the maxmimal sequence of equal consecutive elements. I am trying to follow …

Member Avatar for ddanbe
0
277
Member Avatar for ChrisHunter

What is the best way to get the object, within a list of that object type, that has the highest ID number? I've been trying to figure it out and I can manage to get the highest ID number but not the object containing that ID number. Any help would …

Member Avatar for Ketsuekiame
0
238
Member Avatar for balamurugan.rajendran.14

Hi, Could someone please help me to optimize the attached code file. as i'm new to c# world. Thanks in advance cheers

Member Avatar for JorgeM
0
223
Member Avatar for G_Waddell

Hi All, I'm fairly new to using Linq but I thought I had a handle on it, apparently not though. I'm processing an XML file sent out as an error report by a third party. I have no control over this file and it has been developed to an industry …

Member Avatar for G_Waddell
0
617
Member Avatar for ddanbe

Could one be preferred over the other in terms of performance? Both option have to traverse the whole array somehow to find out which string contains an 'a'. Or does it not matter much and is it just a syntax thing. Or are there better ways to do this? All …

Member Avatar for Ketsuekiame
0
284
Member Avatar for Begginnerdev

Hello my fellow Daniwebies! I have a curious, possibly unique, and odd problem for everyone! We support an ASP.NET application which is using VB.NET for code behind. We use LINQ to SQL and classed object for the data retreival. I have an object called...myObject which is being deleted: Public Shared …

Member Avatar for Begginnerdev
0
268
Member Avatar for GeekPlease

Hello folks, I'm currently studying how to use LinQ in VB.NET but I guess I'm stock. I'm using VS 2008 version (framework) 2.0 Anyone who can help me get through this??

Member Avatar for GeekPlease
0
284
Member Avatar for jkvt

Hi, I have two LINQ queries that produce two different results, but the fields, while having different names, are essentially the same. I am trying to union them together (although concat in this case should produce the same results), but I am getting an error. My thought is that I …

Member Avatar for jkvt
0
4K
Member Avatar for Kratoswoo

So I have this linq code and I am trying to get it to look at the datbase and what it is doing is pulling back the last record put into the database. My asp page refreshes and displays the new information that was updated. What I want is to …

Member Avatar for Kratoswoo
0
221
Member Avatar for goco17

good morning guys, i'm developing a website. whereby have to move through records..next and previous...i did something like this public Product NextProduct(List<Product> products, Product product) { Product nextproduct = (Product)product; for (int i = 0; i < products.Count; i++) { if (Equals(products[i].ProductId, product.ProductId)) { if (products[i + 1].ProductId == null) …

Member Avatar for goco17
0
196
Member Avatar for charlybones

Ok so I'm a total noob with VB.NET and I so far I've read about a thousand forums and I've yet to get a straight answer. I've read that VB treats anonymous types differently than C# (the why, beats me). I have a DataTable, and I want to return a …

Member Avatar for Begginnerdev
0
3K
Member Avatar for SpyrosMet

Hey everyone, so I have this project for windows phone i have to do and I have to put some pins on a bing map, but in order to do that I make an API request to google for google places. I get back an XML file and it's like …

Member Avatar for Ketsuekiame
0
3K
Member Avatar for singularity~

My linq query won't insert my data. What am I doing wrong? class Query { musicEntities db = new musicEntities(); public bool findArtist(string artist) { bool status = db.Artists.Any(w => w.Name.Contains(artist)); return status; } public void insertArtist(string artist) { if (findArtist(artist) == false) { Artist art = new Artist { …

Member Avatar for singularity~
0
250
Member Avatar for lulu79

I have a LINQ function to get 3 things :: Line, Average of Duration and Count I have a problem to sort it based on Average Of Duration column. Here is my code: Dim group2 As IEnumerable(Of DataRow) = _ From row In Ds.Tables(0).AsEnumerable() _ Group row By LINENAME = …

Member Avatar for lulu79
0
745
Member Avatar for Begginnerdev

Hello my fellow DaniWebbers, I have a question for you. Problem: I am troubleshooting an ASP.NET (some one else wrote) page that has an insert form. The user can insert, using linq, into the database. I want to check the database for the values before inserting the values. (Safeguarding from …

Member Avatar for Begginnerdev
0
321
Member Avatar for kRod

Hello all. I have a question on searching a List(Of CLass). I am not sure how it is labeled List<OF T> or List(Of Class) However you label it here is the Class EXT Public Class EXT Implements IComparable Private m_extension As String Private m_exe As String Private m_description As String …

Member Avatar for kRod
0
468
Member Avatar for mani-hellboy

Hi friends., I am now try to study LINQ in C#.net which book can i refer and that is easy to learn and give perfect example code snippet

Member Avatar for thines01
-1
223
Member Avatar for Mike Askew

Hi there, I have two tables in my data entity model accessed by StaffDB. Staffs contains: StaffID FirstName LastName Address Town County Postcode YearJoined CurrentGrade Role Ratings contains: RatingID StaffID Date Rating1 (automatic to avoid conflict with table name also of rating) Comments These are linked by StaffID. I am …

Member Avatar for thines01
0
956
Member Avatar for ssreevidya.m

hai , I used LINQ in application. I want to perform batch update. For that i used the code as: [CODE] int[] istudentId = new int[]; int j = 0; for (int i = 0; i < GrdStudent.Rows.Count; i++) { if ((GrdStudent.Rows[i].FindControl("chkSelect") as CheckBox).Checked) { istudentId[j] = ObjStudent.Student_Id; j++; } …

Member Avatar for stbuchok
0
143
Member Avatar for croker10

Hi All, I am trying to use to linq to retrieve some data, and creating my queries dynamically with where clauses added to an IQueryable object. The problem I am running into is filtering for days of the week. In the table, I have a datetime of a call. I …

Member Avatar for thines01
0
220
Member Avatar for drax12

Hey guys, I'm want to retrieve results from the database, where datetime picker given value, is equal to database value. var _check = (from day in Check.tbl_employees where day.d_from== _frm && day.d_to == _to select new { day.desg_id, }).FirstOrDefault(); datetime picker gives a value with its time,but i'm only interested …

Member Avatar for drax12
0
711
Member Avatar for Timmo987

Hi! I need to be able to change the location of the database at runtime through a menu in my program. My question is how to best achieve this. If for example the ip to the server change, the user need to be able to update the database path; i.e. …

Member Avatar for Timmo987
0
184
Member Avatar for barriegrant1

hey, im currently creating an e-commerce store, im quite new to ASP.NET and C#. im trying to create a menu that is generated based on the database tables. i have created a stored procedure, which works correctly: [CODE] ALTER PROCEDURE dbo.getProductsForCat AS SELECT * FROM products_cat WHERE product_cat_id IN ( …

Member Avatar for barriegrant1
0
293
Member Avatar for lordbaddkitty

I'm trying to LINQ two tables based on a dynamic key. User can change key via a combo box. Key may be money, string, double, int, etc. Currently I'm getting the data just fine, but without filtering out the doubles. I can filter the double in VB, but it's slooooow. …

Member Avatar for lordbaddkitty
0
272
Member Avatar for PierlucSS

I've been working on something with alot of iteration (foreach) and now that everything is working I'd like to optimize it by changing it to link. Currently I am trying to translate this foreach code to LINQ [CODE] int count = 0; foreach( string file in Directory.GetFiles( path )) { …

Member Avatar for PierlucSS
0
141
Member Avatar for k1robert

Hi i'm creating my Data Access Layer and I want to return my object but not all the fields so this is the code i'm using [CODE] Public Function BasicSearchProposals(ByVal searchvalue As String) As IEnumerable(Of DCProposal) Dim dc As New PPDataContext() Dim proposals = From p In dc.DCProposals _ Where …

Member Avatar for kvprajapati
0
1K

The End.