Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 613111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:58:00+00:00 2026-05-13T17:58:00+00:00

I am using VS2008 (no option for VS2010 right now) and am doing a

  • 0

I am using VS2008 (no option for VS2010 right now) and am doing a (reverse) Contains to try to match a partial string to a whole string. For instance, the urlRef = http://www2.rivworks.com/feed-test-1/?SSScrollPosition=0 and the defaultUrlDomain = www2.rivworks.com.

IList<vwCompanyDetails> efMatchingUrlCompanyList = null;
...
efMatchingUrlCompanyList = _dbRiv.vwCompanyDetails
                                 .Where(a => urlRef.Contains(a.defaultURLDomain) 
                                          && a.isCompanyDeleted == false)
                                 .ToList();
bool foundCompanyUrl = (efMatchingUrlCompanyList.Count > 0);

Looking at my database, I should get 3 records from this query. Instead, I am getting zero records in efMatchingUrlCompanyList. (edited)

Any ideas or will I have to get all of the company details then do a manual check of each record in a loop?


NOTE:

I added a secondary way of doing this and this works.

var efMatchingUrlCompanyList2 = _dbRiv.vwCompanyDetails.Where(a => a.ClientID != null && a.ClientID > 0 && a.defaultURLDomain != null).ToList();
foreach (vwCompanyDetails myDetail in efMatchingUrlCompanyList2)
{
    if (urlRef.ToLower().Contains(myDetail.defaultURLDomain.ToLower()))
    {
        efMatchingUrlCompanyList.Add(myDetail);
    }
}
foundCompanyUrl = (efMatchingUrlCompanyList.Count > 0);

I added the WHERE clause to shorten down the record set to something I knew would be valid. I will continue playing around with the original to see if I can get it to work as expected.


NOTE 2:
I downloaded and am using LINQPad. I connected to my EF model and created this small piece of code:

void Main()
{
    IList<vwCompanyDetails> efMatchingUrlCompanyList = null;
    string urlRef = "http://www2.rivworks.com";
    efMatchingUrlCompanyList = vwCompanyDetails.Where(a => urlRef.Contains(a.defaultURLDomain) && a.isCompanyDeleted == false).ToList();
}

I looked at the generated SQL and this is what it generated (I cut out 90% of the columns for brevity):

-- Region Parameters
DECLARE p__linq__1 NVarChar(17) SET p__linq__1 = 'http://www2.rivworks.com'
-- EndRegion
SELECT 
[Extent1].[CompanyId] AS [CompanyId], 
[Extent1].[CompanyName] AS [CompanyName], 
[Extent1].[isCompanyDeleted] AS [isCompanyDeleted], 
[Extent1].[ClientID] AS [ClientID], 
[Extent1].[defaultURLDomain] AS [defaultURLDomain], 
FROM (SELECT 
      [vwCompanyDetails].[CompanyId] AS [CompanyId], 
      [vwCompanyDetails].[CompanyName] AS [CompanyName], 
      [vwCompanyDetails].[isCompanyDeleted] AS [isCompanyDeleted], 
      [vwCompanyDetails].[ClientID] AS [ClientID], 
      [vwCompanyDetails].[defaultURLDomain] AS [defaultURLDomain], 
      FROM [dbo].[vwCompanyDetails] AS [vwCompanyDetails]) AS [Extent1]
WHERE ((CAST(CHARINDEX([Extent1].[defaultURLDomain], @p__linq__1) AS int)) > 0) 
AND (0 = [Extent1].[isCompanyDeleted])

I copied/pasted this into SQL Mangler and tried to run it. I got an error. I looked at the definition again and low and behold – the p__linq__1 variable DOES NOT have an @ symbol. It is trying to treat it as a cursor instead! I manually added the @ symbol in SQL Mangler and it runs flawlessly!

So, the next question – WHY is it doing this? Is this a known issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:58:01+00:00Added an answer on May 13, 2026 at 5:58 pm

    Since no one can come forward on the generated SQL I have chosen to use the less efficient route as in my first note. Bummer really…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows service that is written in C++ using VS2008. I now
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
Im using vs2008 and Im also using the autogenerated object model / entity classes
I am using VS2008 and Resharper. Resharper creates a directory _Resharper.ProjectName. These files provide
I'm using VS2008 to debug an application that starts a new process. I believe
The coding is done using VS2008 There are two divs in my page namely
I'm using VS2008 for a C++ project. The code is quite old and has
I'm using VS2008 C# Express and the Northwind database on a Windows Form application.
I am using VS2008 to develop a WinForms 2.0 application. I have read about
Im currently using vs2008 with asp.net mvc framework for web development. Im missing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.