DataSource Controls :: A Simple LINQ Query Doesn't Seem To Work?

Feb 26, 2010

I have records with and without a email entered in the field called 'email'.

This one works:

Return From p In db.myTable _

Where p.Email.Length > 0 _

Select New With {.p.Name, p.Email}

but this doesn't

Return From p In db.myTable _

Where p.Email.Length = 0 _ ( nor does Where NOT p.Email.Length > 0 )

Select New With {.p.Name, p.Email}

Am I missing something?

View 2 Replies


Similar Messages:

ADO.NET :: Linq Query Doesn't Work?

Aug 10, 2010

When i type and run the following query in ASP.net, then get a error ("Comparison of the data types ntext, text, XML and image data types can not be processed by SQL Server.") (translated from Dutch...)

var gebruikerrow = from u in db.Users
where u.login=="dsf"
select u.login;
foreach (var Result in gebruikerrow)
{
Label50.Text += Result.ToString() + " ";
}

What am i doing wrong?

the Datatype for login (in the table Users) is Text.

View 1 Replies

DataSource Controls :: Select Query Doesn't Work When Data Is Present In Arabic MS Sql 2005

Jan 26, 2010

This query does not return any record

[code]....

View 3 Replies

DataSource Controls :: LINQ To Entities Sub - Query - Doesn't Support The "IN" Clause

Apr 7, 2010

I'm having trouble writing what should be a simple sub-query using LINQ to Entities. I have two tables: Customers and Orders that have a relation on the CustID field. Not all Customers have a record in the Orders table, while some have mutiple records. In traditional SQL, you could write the query like this: SELECT * FROM Orders where CustID IN (SELECT CustID FROM Customers) I know this could be done as a JOIN in both SQL and L2E, but my actual query is more complex (about 8-9 joins), so I am hoping to find a L2E sub-query equivalent. Something like this:

[Code]....

I know LINQ to Entities does not support the " IN " clause, so I am looking for something that will work in its place.

View 2 Replies

Web Forms :: 1.1 - Simple Class Doesn't Work

Mar 19, 2011

Why the following code (asp.net 1.1) does not work?

//call.aspx
<script runat="server">
namespace DOTNETMath {
void Page_Load( Object s, EventArgs e )
{
ConstClass.DisplayEmployee("Testing");
}
}
</script>
//commonFunction.cs
namespace DOTNETMath {
Public Class ConstClass {
Public Shared Function DisplayEmployee(String x) {
Return x + " Hello ";
}
}
}

View 14 Replies

AJAX :: Simple Web Service Doesn't Work On Server?

Mar 6, 2010

The following 'hello world' webservice works fine on my computer (VS2008) but I can't get it to work on the server--either from an aspx page (below) or when invoked directly. I get '404 page not found' on the direct invocation.

[Code]....

I added the HttpGet and HttpPost to test the web service directly on the server. I can open the page and invoke it, but then get the 404 page not found response.

View 5 Replies

DataSource Controls :: How To Convert Sql Query Into Linq Query

Mar 10, 2010

select Groupid,GroupName,onorusername from palgroup where groupid in (select distinct Groupid

View 5 Replies

DataSource Controls :: LINQ To SQL Doesn't Write To DB?

Mar 29, 2010

I have something like the following in pages in two different projects, which saves to a DB with a LINQ to SQL operation:

[Code]....

One of the pages works with this code and the other doesn't. The only difference is that the project in which it does work employs a data control tool (ListView) and a custom profile provider.

View 3 Replies

DataSource Controls :: UPDATE Doesn't Work - How To Fix It

May 19, 2010

I try and update my table with the following

[Code]....

I dont get an error or anything, nothing happens, and the date remains the same.

View 9 Replies

DataSource Controls :: Query Using Linq To Sql?

Jun 25, 2010

I´m using Linq to Sql in my asp.net application, but the problem is:I have a query like this:

[Code]....

My query is not returning anything, how do I do to get this?my problem is with this interval I need to have.

View 2 Replies

DataSource Controls :: REPLACE Doesn't Work With Diacritics?

Jan 11, 2010

my table i have a column named [Name] nvarchar(255)[Name] can be a string witch can have some diacritics like "Ăă, Ââ, Îî, Țț, Șș"If i am using this, it returns for word "Antichități" the string "Antichitați"

[Code]....

But if i am trying to replace "È›" with "t", it doesn't work

[Code]....

The result is still "Antichități"How can i resolve this issue?

View 3 Replies

DataSource Controls :: Linq To Sql Doesn' Support IHaveParent.ParentId Map?

Jan 29, 2010

[Code].... Linq to sql doesn' support IHaveParent.ParentId map?

View 2 Replies

DataSource Controls :: One Linq Query With Two Db Connection?

May 31, 2010

I want to use from two db connection in one linq query

My sample is:

int a=1;
if(a==1)
DataClasses1DataContext1 db = new DataClasses1DataContext1();
else
DataClasses1DataContext2 db = new DataClasses1DataContext2();
var q =
from c
in db.F_Groups
select c;

In this code a=1 so db connection is DataClasses1DataContext1

I want if a=2 then db connection = DataClasses1DataContext2

but this code is error.

db connections is completely same but in two deferent class a db connection is sql and another is oracle

View 4 Replies

DataSource Controls :: How To Convert Sql Query To LINQ

Feb 13, 2010

How can I convert this sql query to LINQ ?

[code]...

View 1 Replies

DataSource Controls :: Linq To Sql Query / Zip Codes?

Feb 18, 2010

Im doing thing profile, zip code thing on my site. One table has a list of zipcodes and in the other is a profile and there they keep what zip code they entered. I already have the radius code but idk how to get a list of all the profiles in a radius.I'm going to store the zip codes that come back from the zip code table in a arraylist and put it in a session state so i don't have to keep getting the same thing over and over again. The problem is i don't know how to write the linq to sql query to take the arraylist of zip codes and look up all the users that have that as there set zip code in there profile.

View 1 Replies

DataSource Controls :: Return First Value From A Linq Query?

Mar 12, 2010

Is there a way opf getting the first value from a linq query so for example

[Code]....

View 2 Replies

DataSource Controls :: Add A New Item To A LINQ Query?

May 13, 2010

So I'm trying to add a single item to a query I wrote. The query is then pass to the e.Result of a LinqDataSource_Selecting event. This datasource is being used by a dropdown list and label in a listview.

I am trying to add a "New" field to the end of the list.

Currently I have this working, but it seems like a really messy solution. First I make a class with the fields I need:

[Code]....

Then I build the query:

[Code]....

Then a second list and query with the new value:

[Code]....

Finally, I union the two and set the e.Result:

[Code]....

View 5 Replies

DataSource Controls :: Retrieve Value From LINQ Query?

Mar 20, 2010

I need to know how to extract the result of the attempted LINQ query below and set it equal to the strFile variable.Everything Intellisensed OK here but ine 5 shows a syntax error at the parenthesis.

[Code]....

View 12 Replies

DataSource Controls :: Linq Query With OrElse?

Apr 7, 2010

I'm having a problem with a Linq query where is executing the second half of an OrElse even though the first half evaluates to true.

[Code]....

When Manufacturer is null, I get a NullReferenceException. The "Manufacturer.Trim()" should never be executed, because the first half of the OrElse evaluates to true. Just to test it out, I also tried this:

[Code]....

This actually works fine... Manufacturer.Trim() is never executed, and I get no error. Why is the Trim() statement being executed in the first case? If Manufacturer is null, then it shouldn't be.

View 4 Replies

DataSource Controls :: GridView Update Function Doesn't Work.

Jan 27, 2010

I got a gridview to display the data from the database properly but when I go edit. it give me an error. I searched and change ConflictDetection=CompareAllValues to OverwriteChanges

The error goes away. However the database is still doesn't update. Does anyone had to tweak the gridview function to make it works. Maybe I did something wrong.

View 1 Replies

DataSource Controls :: LINQ Doesn't Reference Data Context In ListView?

Feb 7, 2010

I'm trying to add a LINQ datasource to my ListView control but it doesn't pick up the data context that I created. All it shows as options in the dropdown list are AJAX objects. What could be the possible causes for this?

View 3 Replies

DataSource Controls :: LINQ To SQL - Multiple Queries Doesn't Return Any Results

May 25, 2010

I am working on asp.net 3.5 and in MVC using Linq to SQL classes. In my MVC project i am calling stored procedure using linq to sql that conatin query joining two tables.Below is my code in Partial class

[
Function(Name="dbo.GetUserWiseThreadDetail_SP")]
[ResultType(typeof(Thread))]
[ResultType(typeof(Reply))]
public
IMultipleResults GetUserWiseThreadDetail_SP([Parameter(DbType="VarChar(30)")]
string userID)
{
ExecuteResult result = this.ExecuteMethodCall(this,
(MethodInfo)(MethodInfo.GetCurrentMethod())), userID);
return ((IMultipleResults)(result.ReturnValue));
}

In one of the controller i have made one more class

public class
MypostIndexData
{
public
IEnumerable<Thread> Thrds {
get;
set; }
public
IEnumerable<Reply> Repls {
get;
set; }
public MypostIndexData(IEnumerable<Thread>
thrds,IEnumerable<Reply> repls)
{
this.Thrds=thrds;this.Repls=repls;
}
}

finally coding of controller action method

ForumDataContext pmforum = new
PMForumDataContext();
public
ActionResult MyPosts(string userId)
{
IEnumerable<Thread>thrds;
IEnumerable<Reply>repls;
IMultipleResults result = pmforum.GetUserWiseThreadDetail_SP(userId); (this satement doesnot give any result,if i execute stored proc in
sql it give the results)
thrds = result.GetResult<Thread>();
List<Thread> thrdlist =
new
List<Thread>(thrds);
repls = result.GetResult<Reply>();
List<Reply> replylist;
if (repls !=
null)
{
replylist = new
List<Reply>(repls);
}
return View(new
MypostIndexData(thrds,repls));

I am unable to understand why i am not getting any results?

View 5 Replies

DataSource Controls :: Random Results From A LINQ To SQL Query?

Jan 23, 2010

I have this LINQ query:

var agnts = (from a in db.agents select new { a.userid, a.name }).Take(10);

How can I get randomly get 10 records from my agents table?

I have tried:

agnts = agnts.OrderBy(n => Guid.NewGuid());

but this doesn't seem to do anything.

View 5 Replies

DataSource Controls :: SQL Query Re-Write In Linq To Entity?

Jan 26, 2010

Need to figure out the correct way to do a simple SUM function in Linq, but also manipulate one of the feilds coming back by doing a Substring on it, here is the original SQL query:

[Code]....

View 1 Replies

DataSource Controls :: LINQ And C# - Accessing More Then 2 Tables In A Query

Apr 23, 2010

As the title sugests, I am missing a (basic?) concept as I teach myself asp.net, linq, and C#. It has been awhile since I've done anything object oriented, so I don't know how much that is impacting this gap in my understanding. Anyhow, here is what I am trying to do. I have three SQL Server tables: PERSON, POSITION, AREA. There is a 1 to many relationship between PERSON and POSITION, and a 1 to 1 relationship between POSITION and AREA. Given the following code I verify who the person is who has logged into the browser:

[Code]....

I want to be able to return all of the AREAs the person is able to access, based on the position they currently hold. I am able to easily do this in a SQL Server query, and I am sure I can do this with a SQL stored procedure once I pass the EMPLOYEE_ID to the procedure. However, I would rather do this in the page_load event, and load the returned results into gridview1 for the viewer. The issue I am running into is in building the LINQ query. When I try to build it, I can only get access to two of the three tables, depending on which table I select with db. Is it possible to access all three tables in the same query?

View 10 Replies







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