ADO.NET :: Combine 2 Linq Queries?

Jul 27, 2010

Is it possible to combine these 2 linq queries ?

[Code]....

View 2 Replies


Similar Messages:

DataSource Controls :: Combine The LINQ Queries Together And Have Access To Both Of The Results Independently?

Feb 25, 2010

Is there a way to combine the LINQ queries together and have access to both of the results independently?

[Code]....

View 10 Replies

SQL Server :: Combine Two Queries In One Resultset?

Sep 6, 2010

I want to combine two queries like :

select name as name1 from table1 where id = 6

and

select name as name2 from table1 where id = 2.

I need a single resultset. How can I do that?

View 26 Replies

SQL Server :: Combine Two Self Referencing Queries In A Function?

Feb 23, 2011

I have a menu table which has a (mostly) unlimited number of levels/tiers:

[Code]....

I also have a working function which will give the up and down tiers based on a given MainMenuId:

[Code]....

My question is, is there a better way to do this such as combining the two querries? Every attempt I have made results in a "The Statement terminated. The maximum recursion 100 has been exhausted before statement completion"

View 4 Replies

ADO.NET :: Can't Combine "LINQ Join" With Other Tables?

Jan 8, 2011

The main problem is that I recieve the following message:

"base {System.SystemException} = {"Unable to create a constant value of type 'BokButik1.Models.Book-Author'. Only primitive types ('such as Int32, String, and Guid') are supported in this context."}"

based on this LinQ code:

[Code]....

How shall I solve this problem to get a class instance that contain with property title and Book-AuthorID?I also have tried making some dummy by using "allbooks" relation with Code Samples from the address

http://www.hookedonlinq.com/JoinOperator.ashx. Unfortunately, still same problem.

I also have taken account to Int32 due to entity framework http://msdn.microsoft.com/en-us/library/bb896317.aspx. Unfortunatley, still same problem.

Using database with 3 tables and one of them is a many to many relationship. This database is used in relation with entity framework

Book-Author
Book-Author (int)
BookID (int)[code]....

View 1 Replies

MVC :: Linq - Use Normal Sql Queries?

Jan 11, 2011

When i see MVC Music store. They have used ADO.NET entity data model and used LINQ language to perform operation in DB.. Is there any way to use normal sql queries?

View 3 Replies

ADO.NET :: Converting SQL Queries To Linq?

Jul 31, 2010

How to convert SQL Queries to Linq.is their any tool available to convert SQL Queries to Linq

View 2 Replies

C# - Difference Between These LINQ Queries?

Mar 18, 2010

I use LINQ-SQL as my DAL, I then have a project called DB which acts as my BLL. Various applications then access the BLL to read / write data from the SQL Database.

I have these methods in my BLL for one particular table:

public IEnumerable<SystemSalesTaxList> Get_SystemSalesTaxList()
{
return from s in db.SystemSalesTaxLists
select s;
}
public SystemSalesTaxList Get_SystemSalesTaxList(string strSalesTaxID)
{
return Get_SystemSalesTaxList().Where(s => s.SalesTaxID == strSalesTaxID).FirstOrDefault();

[Code].....

View 2 Replies

ADO.NET :: How To Build Dynamic Linq To SQL Queries

Nov 7, 2010

I'm trying to do something that on the face of it is very simple.

If I have 5 text boxes, and 1 of them is blank, I want to exclude that textbox from the query, rather than searching for where a field is blank.

I've tried to do a bit of research into dynamic linq queries, but have come up empty handed, or what I've found doesn't seem to quite answer my question.

View 3 Replies

ADO.NET :: Time Difference In Linq Queries?

Aug 20, 2010

I have my Linq query in which i need to find time difference(not days difference).

The field in database is datetime.

Dim ldtToday
As DateTime = TimeOfDay
Dim SR_RM_InnerJoin =
From SR
In lcntxRT60Entities.RtSReports _
Join RM
In lcntxRT60Entities.RtRMaster
On SR.RtRMaster.ReportID
Equals RM.ReportID _
Select SR, RM _
Where SR.TID = 1 _
And --(Check) SR.ReportDeliveryTime.Value.AddDays(1) < ldtToday

How can i check if the time field of the record is less than current time??

View 5 Replies

C# - Efficient And Proper Linq Queries From Database

Nov 9, 2010

A sample linq query from MSDN: var expensiveInStockProducts = from p in products where p.UnitsInStock > 0 && p.UnitPrice > 3.00M select p; Does this query select EVERY column from the database table immediately, or does it return some sort of pointer that retieves the actual column data on demand? ie. If there are 50 columns in my table and I only use a single p.UnitsInStock in my actual code, then am I retrieving 50 times more data than I expected?

View 2 Replies

C# - Linq To Sql - Executing Multiple Queries On The Same Transaction?

Nov 2, 2010

I am creating entries in a contract table using linq to sql.

One column needs to conditionally be assigned an application number from a range of values.

I'd like to simply increment the max existing value, however it is a multi-user application and I'm concerned about multiple contracts receiving the same app number if they happen too close together.

Is there a way to either force the entire thing to use the same transaction, or to execute both during the same submit?

View 4 Replies

ADO.NET :: How To Improve The Application Performance While Writing LINQ Queries

Dec 17, 2010

how to improve the application performance while writing LINQ Queries ?Like the optimization techniques.

View 2 Replies

Linq To SQL - How To Get Total Number Of Results When Paging Without Two Queries

Dec 29, 2010

I've got the following LINQ query to my IQueryable service

Dim eventcount = EventService.QueryEvents().Count
Dim eventlist = EventService.QueryEvents().Skip((page - 1) * 5).Take(5).ToList

But I'm wondering if there's a way to do this without making two calls to the database?

View 2 Replies

MVC :: Finding Books And Links For Mvc And Learning Linq Queries

Nov 10, 2010

i want to get masterized....in MVC

finding books and links for mvc..and learning linq queries

View 4 Replies

C# - Returning A Max/limit When Using .Include () In LINQ-to-Entities Queries?

Mar 6, 2011

Is there a way to cap the number of records returned when an .Include() method is called on an ObjectQuery<>? Basically, if one of my entities is in a one-to-many relationship, such as a Band entity to a list of Fan entities (where a band can have any number of fans), how can I limit the number of fans returned?

In the example: var band = ctx.Bands.Include("Fans").SingleOrDefault(b => b.BandId == someBandId);

If I use the Include, it will return all fans. How can I query that Fans navigation property to return only a subset or max?

View 2 Replies

ADO.NET :: Preventing Duplicate Records Being Returned From Linq To Sql Queries?

Aug 8, 2010

I've got a linq to sql query that pulls data from 2 different tables and contains an or statement:

[Code]....

The problem I've got is that some queries match both sides of the or statement so it returns the same record twice.

How can I eliminate these duplicates quickly and easily?

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

Architecture :: DAL As Web Service - Adding A Service Reference To Project And Then Using The EF4 Context And Writing LINQ Queries Against The DB?

Feb 10, 2011

I'm currently trying to work out the best way to build this web application, which will then be intergrated on other systems, such as WinForms, Intranets etc.

We hope to include the usual layers i.e. DAL, BLL, BOL and UI but I have been experimenting with Entity Framework 4 and WCF Data Services and managed to get something in place where I was using WCF as a gateway to EF4.

i.e. Adding a Service Reference to my project and then using the EF4 context and writing LINQ queries against the DB

e.g.[Code]....

Now with the current setup I would still need to write a DAL Class Library, that interacts with the Data Service, because as I said WCF Data Services only seems to be a gateway, I can't see where to put the code (above) in the Data Service and then how I could these methods.

My questions are: 1. How do I develop a WCF Data Service in such a way to allow this behaviour - I know how I could do it using ASMX web service, something like [Code]....

2. If I am to use WCF Data Services, how is serialization handled (if at all) - again I know how to do something in ASMX web services

3. Again, If I am to use WCF, how do I add Security and only allow my applications to access the web service - for obvious reasons

4. Would it be possible / logical to also include the Business Logic Layer into the web service?

View 4 Replies

SQL Reporting :: Can Combine LIKE And IN

Nov 4, 2010

I have a report with several filter parameters. Everything works fine presently. For one parameter, I use the LIKE as follows in my WHERE statement:

WHERE drug LIKE '%' + @drugused + '%'

@drugused is the selection value of a dropdown list. But now I want to change my parameter to allow multi-selection. But I am not sure how to write my WHERE statement for this. Normally I would use IN but I'm not sure how to do this with the LIKE.

View 6 Replies

C# - Can Combine Two Objects Into One

Oct 3, 2010

I'm preparing to pass values to a method:

private string BuildMessage(int templateID, string body, object data)


where the data param is an array of name/value pairs. To prepare my values for that data param I need to combine the properties of a strongly typed class with the values of a simple 2d array.

What's the best way to merge those values?

View 1 Replies

Utility To Combine Querystrings?

Apr 28, 2010

Is there a utility to combine querystrings? I'm looking for something like:

Input: Combine("test=a&test2=b", "test3=c") Result: "test=a&test2=b&test3=c"
Input: Combine("test=a&test2=b", "") Result: "test=a&test2=b"
Input: Combine("", "test3=c") Result: "test3=c"

And maybe some weird ones:

Input: Combine("&test=a&test2=b", "?test3=c") Result: "test=a&test2=b&test3=c"

View 5 Replies

Combine Silverlight) With SAP Webdynpro?

Mar 1, 2010

Does anybody knows possibilities or approaches to combine ASP.NET with SAP Webdynpro (or to embed/integrate Webdynpro in a ASP.NET (or Silverlight) application) ?

View 2 Replies

C# - Combine MP3 Files In Response?

Jan 19, 2010

I lied! The commandline fails if the two source files have different bitrates (does samplerate matter?). Also, the source code below succeeds when the two sources are the same bitrate. So, this looks like a bitrate challenge now.

Original question:

result.mp3 (from the commandline, below) is playable in WMP11. The ASP.NET code below serves a file which plays fine in WMP11. But, when I uncomment those two lines, WMP11 won't play the file. Something about the code that merges the two MP3 files isn't to the satisfaction of WMP11. How can I change the ASP.NET code to merge the two MP3s in the HTTP response with the success that the 'copy' commandline gives me?

protected void Page_Load(object sender, EventArgs e) {
Response.Clear();
Response.ContentType = "audio/mpeg";
Response.AddHeader("Content-Disposition", "attachment; filename=test.mp3");
var bytes1 = System.IO.File.ReadAllBytes(@"C: est1.mp3");
WriteBytesToResponse(bytes1);
//var bytes2 = System.IO.File.ReadAllBytes(@"C: est2.mp3");
//WriteBytesToResponse(bytes2);
Response.End();
}
private void WriteBytesToResponse(byte[] sourceBytes) {
using (var sourceStream = new MemoryStream(sourceBytes, false)) {
sourceStream.WriteTo(Response.OutputStream);
}
}

copy /B test1.mp3+test2.mp3 result.mp3

View 3 Replies

Can Combine WebResource.axd CSS Requests

Sep 15, 2010

I have developed some ASP.NET server controls which include their own javascript and css files. A lot of these controls use jQuery extensions which, as you know, often include their own css files.

I'm using Telerik's RadScript manager which combines the javascript like a boss. However, I'm using the AjaxToolkit's ClientCssResource attribute to include the css files in my server controls, and I have noticed that the CSS files are not getting combined at all. My pages have 10-15 WebResource.axd requests for css files for my server controls.

Everything I find only is about combining javascript, and nothing tells me how I can combine the CSS files. Does anyone know if there is a way to combine the CSS dynamically (I don't want to manually combine as each page might use a different subset of the server controls)?

View 2 Replies







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