.net - AndAlso In VB Linq Query Doesn't Seem To Be Working?

Sep 14, 2010

The below query fails with Null Reference Exception when there are elements in BOMIDs where MatID property is nothing.I thought the 'x.MatID isnot Nothing AndAlso' would prevent the x.MatID.Process part of the where from being executed. There are a couple elements in the BOMIDs collection that where MatID is nothing.

From x In BOMIDs _
Group Join y As PurchasedProcess In SpecialProcesses _
On x.MatID.PurchasedProcess Equals y.Name _
Into G = Group _

[code]....

View 2 Replies


ADVERTISEMENT

Join Doesn't Working In LINQ In Devexpress XPO

Nov 23, 2011

I have used persistance class and used following LINQ query.[code]but it throws an error saying. "Specified Method is not Supported".How can i get data from two table using XPO Persistance Class?

View 1 Replies

.net - Linq To AD Query Not Working?

Sep 20, 2011

user.fld_usr_name is a string with the value random name user is an object that is given as a parameter

ByVal user As GUser

this is the linq query that doesn't work

Dim result = (From usr In users Where usr.Name.Contains(user.fld_usr_name) Select usr).ToList()

this is the one that works

Dim result = (From usr In users Where usr.Name.Contains("random name") Select usr).ToList()

this is the error

Object reference not set to an instance of an object.

I am using this in Linq to Active Directory library which probably means it's linq to entities I've tried everything?

View 3 Replies

Linq Query On Dictionary<TKey, TValue> Working As DataSource?

Dec 21, 2010

I have the following in VB:

Dim sources = From source In importSources Select New With _
{.Type = source.Key, .Source = source.Value.Name}
dgridSourceFiles.DataSource = sources

[code]....

View 2 Replies

LINQ Query Is Enumerated - Turn On Some Kind Of Flag That Alerts Me Each Time A LINQ Query Is Enumerated?

Sep 22, 2009

I know that LINQ queries are deferred and only executed when the query is enumerated, but I'm having trouble figuring out exactly when that happens.Certainly in a For Each loop, the query would be enumerated.What's the rule of thumb to follow? I don't want to accidentally enumerate over my query twice if it's a huge result.

For example, does System.Linq.Enumerable.First enumerate over the whole query? I ask for performance reasons. I want to pass a LINQ result set to an ASP.NET MVC view, and I also want to pass the First element separately. Enumerating over the results twice would be painful.It would be great to turn on some kind of flag that alerts me each time a LINQ query is enumerated. That way I could catch scenarios when I accidentally enumerate twice.

View 3 Replies

Smtp Has Suddenly Stopped Working - Doesn't Send Anything And Doesn't Generate Any Exception Message

Oct 13, 2010

I use Visual Studio 2003, VB.net, NetFramework 1.4 and Windows XP I have been using the following Code Snippet for a number of years in both Web Services and Windows Applications. However suddenly around the 29th September 2010 it has stopped sending E-Mails from both Web Services and Windows Applications. The same problem has happened not only to my own Network but on two other Networks, one using XP as its Server and the other using Server 2003. All 3 of these are using different ISPs.

[Code]...

View 1 Replies

.net - ActiveRecord Linq/NHibernate Linq Not Building Query Completely?

Jul 14, 2011

given this function:

Public Function Search(ByVal StartIndex As Integer, _
ByVal MaxResults As Integer, _
ByVal AccountNumber As String, _
ByVal LastName As String, _

[Code]....

instead of what I expected:

Select count(*) from remitline where lastname = "smith"

What am I doing wrong building up the where clause? I'm using Castle ActiveRecord 2.1

View 1 Replies

Performance Gain In LINQ Query Vs LINQ Stored Procedure?

Aug 6, 2009

if there is that much of a performance gain in running a LINQ stored procedure versus a LINQ query?

View 1 Replies

Asp.net - Complex Linq Query - Add A .Where() Or .Any() Predicate To Reduce Query Complexity (in VB)?

Sep 14, 2010

I have to join two main tables, and I need to filter the results by elements in an ASP.NET web form. These filters are created on the fly so I have to use a lot of where extensions to filter the query. I want to execute the query with as optimized SQL as possible.

I am first doing a simple join between TW_Sites and TW_Investigators. Then there are two sub-tables that are involved. TW_InvestigatorToArea and TW_InvestigatorToDisease. While most of the where clauses are working fine, I have found a performance issue that won't be an issue right now, but will be an issue as the table gets bigger.

The arrays DiseaseCategories and DiseaseAreas would be the results of a CheckBoxList result.

Protected Sub LoadResults()
'Get Dictionary of Filters
Dim FilterDictionary As OrderedDictionary = Session.Item("InvestigatorFilterDictionary")
' Initialize LinqToSql

[code]....

View 2 Replies

LINQ Query Using The Dynamic LINQ Library?

Mar 31, 2011

Forgive my ignorance on this.I have this LINQ Query:Dim ngBikersDataContext As New CarBikeWalkDataContext

bikersList = (From c In ngBikersDataContext.Reg_Bikers _
Order By c.L_Name _
Select New Bikers() With { _
.BikerID = c.BikerID, _
.F_Name = c.F_Name, _

[Code]...

with the error "Overload resolution failed because no accesible 'Select' accepts this number of arguments."
Over the "NEW" I get an error " ')'expected."

View 1 Replies

"System.ArgumentException: An Item With The Same Key Has Already Been Added." When Trying To Order An In-memory LINQ Query By A LINQ Association?

Jan 27, 2011

We are doing a query against an in-memory collection of LINQ data objects. The wrinkle is that we are ordering by a column in a related table whose records have not necessarily been loaded yet (deferred loading:)

Dim oPkgProducts = _
From b In oBillPkg.BillProducts _
Where b.Successful.GetValueOrDefault(Common.X_INDETERMINATE) = _

[code]....

View 1 Replies

LINQ To SQL - Add In Row_Number To A LINQ To SQL Query?

Aug 31, 2011

How do I add ROW_NUMBER to a LINQ query or Entity? How can I convert this solution to VB.NET?

[Code]...

I'm having trouble porting that last line. I have been unable to locate a VB.NET example. I'm actually not looking for any paging functionality like the example provides, just good old-fashioned Row_Number(Order By X) row index.

View 1 Replies

VS 2010 Upgrade From 2008 To 2010 - Now LINQ - IntelliSense Is Not Working For LINQ Stuff

Apr 20, 2010

I just upgraded a project from VB 2008 to VB 2010. Before, the project did not use LINQ. I have started implementing it. So, I have updated the target framework from 2.0 to 3.5, and added a reference to System.Core, and imported the namespace System.LINQ to the entire project and also imported System.Data.LINQ into the form I'm working with (because it was not available in the list for Imported Namespaces in the references tab).

It's not throwing any errors now, but my IntelliSense is not working for LINQ stuff.

For example... I write this:

[CODE]....................

Then, if I type S. on the next line, the IntelliSense doesn't grab what it should for S (Only get Equals, GetHashCode, GetType, ReferenceEquals, and ToString, instead of the options I should get like Count, First, FirstOrDefault, etc...). If I Type S.First. then its the same thing, no IntelliSense that lists the available fields for S, just the standard options (Equals, GetHashCode, GetType, ReferenceEquals, and ToString). I should be seeing my column names in my table when I type S.FirstOrDefault.

So any ideas what is going on? When I type the code, for example, MessageBox.Show(S.FirstOrDefault.FirstName), it works perfectly. But it doesn't change the casing of the text (so it would read s.firstordefault.firstname) and no intellisense while doing it. But no errors. BTW - Everything works perfectly when creating a NEW VS 2010 application, it's just my projects upgraded from Visual Basic 2008 that have this issue.

View 2 Replies

VS 2008 Linq Possible To Use Query In Another Query?

Apr 16, 2011

I was wandering is it possible to use a query within another query below is the code I am trying to use.

Public Function GetInventByComp(ByVal CompID As String) Using DC As New DataClassDataContext
'need to get company id's based off names? thats bad should be name from Id need to rethink this
Dim invent = (From C In DC.Inventors_Companies _
Where C.CompID = CompID _
Select C.InventorID).ToString

[Code]...

I was trying to us multiple values in a string like "1, 3, 5" but I can't seem to get that working either so I am trying to use just a single value now. Can anyone help me? "Yes I am new to this"

View 5 Replies

LINQ Doesn't See To Fit Anywhere Else ... MIN / MAX On A Projection?

May 5, 2011

I have the following VB:

[Code]...

The above fails... am wondering how I can get the above to work without iterating over

View 6 Replies

.net - LINQ: Except Doesn't Work In The Expected Way

Jul 18, 2011

I've problems to detect if there are new rows in a DataTable Email_Total that is yet not imported into ContactDetail.

Dim srcUnique = From row In src.Email_Total
Select row.ticket_id, row.interaction, row.modified_time
Dim destUnique = From row In dest.ContactDetail

[Code].....

View 2 Replies

LINQ Question Doesn't See To Fit Anywhere Else... MIN / MAX On A Projection ?

Nov 16, 2010

I have the following VB:

[code]...

The above fails... am wondering how I can get the above to work without iterating over NGL... thx!

View 2 Replies

VBA Library Doesn't Appear To Be Working

Apr 28, 2009

My module won't run, it can't find the project or library, and highlights: the Date function in: MsgBox (Date).This is happening to several VBA functions, but this is the first one.I have all the libraries referenced that I think I need, especially the Visual Basic for Applications checked.There is a MISSING: Office12 library, but the Date function is part of the VBA library, so I don't think this should be the issue.

View 2 Replies

Which Is Better For Performance, And Vs AndAlso

Jul 15, 2011

When writing an If statement, I've always used And when needed like: If 1=1 And 2=2 Then. The only time I ever used AndAlso is if the second condition will error if the first isnt true like: If Not IsDbNull(Value) AndAlso Value=2 Then. However, recently I've heard that AndAlso is better for performance than And as the second condition is only read when the first is true. In this case, should I always just use AndAlso?

View 3 Replies

BindingSource Filter AND Doesn't Seem To Be Working?

Oct 1, 2010

I am developing a Winform Program in visual basic and I am using Access Tables. I want to use a bindingsource filter to do a search on Stock descriptions. I am using this but it doesn't seem to be working

Me.StockBindingSource.Filter = "ITEMNAME LIKE '%" & SearchTextBox.Text & "%' AND [Supplier1 Price] <> 0 AND [Supplier2 Price] <> 0 AND [Supplier3 Price] <> 0"

What's happening is that I am only seeing products where all 3 suppliers have a price listed that isn't 0. (Products have a zero price when it becomes discontinued or supplier doesn't sell that product but we may have purchasing history against it so it can't be deleted). Therefore we do end up with products where all 3 suppliers have a zero cost. These are the products I don't want this search to return.

View 10 Replies

Wpf - ControlLibrary My.application Doesn't Working

Dec 18, 2009

I have built a Wpf-ControLibrary-Project to put some Controls there. In one Control i need to get some informations about assambly, Version and directory path.in the past i have done this one:

Dim msg As String
msg = "AssemblyName: " & My.Application.Info.AssemblyName & Environment.NewLine
msg &= "Version: " & My.Application.Info.Version.ToString & Environment.NewLine
msg &= "DirectoryPath: " & My.Application.Info.DirectoryPath
MsgBox(msg)

but this doesnt working anymore. I get an Error which told me that Application isn't Party of the My Namespace.

View 2 Replies

Difference B/w AND And ANDALSO Operator?

Oct 29, 2009

What is the difference b/w the AND and ANDALSO operator?

View 3 Replies

Difference Between (OrElse And Or) And (AndAlso And And)?

Dec 7, 2011

What is the difference between (OrElse and Or) and (AndAlso and And)?Is there any difference in their performances, let say the correctness benefit?? Is there any situation that I shoudn't use OrElse and AndAlso?

View 4 Replies

Unable To Run AndAlso Statement?

May 9, 2011

Im trying to check service on a remote server.. as i was typing this i kept getting a syntax error on AndAlso statement.

Also, how do i add the path to connect to a remote server to check the service?

Private Sub CheckServiceButton_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckServiceButton.Click
' This will check if the service is running '

[Code]....

View 13 Replies

Why Does Lambda Not Work With AndAlso

Jul 10, 2009

I finally found out that my lambda in the following statement evaluates to false as opposed to the corrected version. Just wondering why:

CODE:

View 7 Replies

ASP.NET Query Strings Doesn't Work

Jul 2, 2009

I got this code in order to build an url for the link using a querystring from the current page. The problem is.... It doens't work.

[Code]....

View 6 Replies

DB/Reporting :: SQL Query Doesn't Return Right Value

Mar 2, 2011

it seems that this query doesnt read the begindate and only displays record with enddate.

Code:
str = ""
str = str & "Select sum(quantity) as totalpurchase from purchaseorder where itemcode='" & itmcode & "' and"
str = str & " category='Consumables' and company='" & company & "' and (datereceive >= '" & datebegin & "' and datereceive <= '" & dateend & "')"
str = str & " and (postatus='received' or postatus='oh-hand')"

i am using vb2010 and mysql community server.

View 3 Replies

SQL - Read 2 Or More Value From One Query Doesn't Work

Mar 11, 2010

I am trying to read data from remote SQL base. I have written the function that works great if you need to get 1 Value , but when I want to read 2 or more value at from one query it doesn't work [Code]

View 4 Replies

Locating External Files Doesn't Working

May 3, 2009

I'm very new to VB, so I was in the very first tutorial, it has me play a sound file. So I put that in, ran it, and it came back with an error saying "system cannot find this file." I guess I'm not terribly surprised, since the file they gave has no C: or anything like that. What I want to do now is play my very own sound file, but I don't want to go through the whole C:Documents and Settings... thing, so is there a way I can put my own sound file in the project directory and say something like %ProjectDir%/sounds/mysound.wav?

View 13 Replies

Understanding AndAlso - Get A Runtime Error?

Oct 5, 2011

Looking at the following code snippet in VS2008 (this is from the SBS book)

Dim HumanAge As Integer = 0
If HumanAge <> 0 And 7 / HumanAge <= 1 Then
MsgBox("1 dog year or older")[code]....

I expect to get a runtime error, because And evaluates both conditions, which is why in this case AndAlso should be the better operator to use. When I try this code there is no difference in behavior between 'And' & 'AndAlso'. In neither case I get a
runtime error, not even when I flip the conditions around. Is this by design, a lucky accident, or do I just not get it?

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved