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


Similar Messages:

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 :: Combine 2 Linq Queries?

Jul 27, 2010

Is it possible to combine these 2 linq queries ?

[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

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

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

What Is Normal Memory Usage Of A Mvc Website

Feb 16, 2011

I have really tried to Google it but only articles about how to troubleshoot memory issues come up. Before I start to troubleshoot, I would like to know if my web site's memory usage is really abnormal or not.

So it is an asp.net mvc 2 website that runs on IIS 7.5 in production. I guess normal memory usage depends upon traffic, so here are the numbers of an average day:

300 unique visitor
400 visits
3000 page views

I would be really happy to get some idea how much is the normal memory usage for this traffic. Also I would be curious to know how memory usage normally increases with traffic growth.

View 1 Replies

Is It Normal That The Page Postback On Enter Key

Jan 18, 2011

iam developing my application using asp.net 2.0 and c sharp. on my default page if i select any place on the page and press enter it postsback. is it normal and can i disable this?

View 4 Replies

C# - Make The Row In Normal Mode After Updating?

Jan 22, 2011

I have a gridview with "Edit Update Cancel" command field. When I click Edit, all the columns in the particular row becomes editable and when I click update, the Table is updated based on the new values. Then the Gridview is binded with the updated datatable. But the "Update Cancel" button still remains.

Once the row , has been updated, the "Update Cancel" button has to be changed to "Edit" So how is that made possible.

This is the code for updating and displaying the updated data

protected void StaticNoticeGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
//Gets the updated value from GridView

[Code]....

View 1 Replies

WCF / ASMX ::Library As Normal DLL Reference?

Oct 26, 2010

i was wondering if it was possible to:create a new WCF Service Library project build the project and reference the dll in a web application,then consume the WCF service from the web application based on that basic dll reference

View 1 Replies

Difference Between Using Normal Array And Hashtable

Mar 6, 2012

reasking some basics to clear out from this messed up things

1) difference between using normal array & using hashtable in terms of storage, access speed

2) is it possible to store values from serverside controls in javascript on client side in a normalĀ  array variable ( values can be of different types) even on postback??.

if yes how

3) currently i have hidden fields which stores values on client side and on postback saves in hashtable ie saving data on server & not on client.

View 1 Replies

Web Forms :: Checkbox Vs Normal Check Box Control Using

Feb 23, 2011

I have the following issue. I am displaying a lot of models from the database. Next to each model name there is a checkbox. So a customer can check as many check box as he wants and when they click on the save button, it gets saved to a table in the database.

I have written the whole code in the code behind. (.cs). But I am having dificulty capturing the check box checked and how can I do it? Here is my partial code:

strLoadCategory +=

"<td>" + dvModels[modct]["Model_Name"].tostring() + "</td><td valign='top' align='left'>"
+ "<input type='checkbox' value='" + dvModels[modct]["product_id"].ToString()
+ "' id='" + dvModels[modct]["product_id"].ToString()
+ "' name='SaveCheck'></td></tr>";
THe number of models is dynamic based on a portal name user selects from a drop down list before this.

View 3 Replies

How To Implement A Normal Website Inside MVC 2 In Html

Mar 27, 2010

I have a website consisting of an index.html, a number of style sheet files as well as some javascript files. Then I needed a way for this site to communicate efficiently with a Microsoft SQL Server, so I was recommended to use the MVC framework to facilitate that kind of communication. I created the C#.net controller code needed to output the necessary information from the database using URL parameters, so now I am trying to put the whole web-site together inside the MVC framework.

View 2 Replies

Memory Usage In IIS Is FAR Greater Than In DevEnv - Is This Normal

Jan 5, 2011

I have an ASP.NET app that scrapes data from a handful of external pages, parses the relevant bits and displays them in a table. Total data retrieved is 3-4MB and the resulting page is about 1MB. I am using synchronous WebRequest GetResponse for the retrieval, but the same problem existed using an asynchronous BeginGetResponse/EndGetResponse process.There is no database access, no session storage, no caching, but an in-memory list of about 100 objects (total 1MB of data), plus a good amount of AJAX (AjaxControlToolkit). This issue appears on the very first run of the app, even if I have restarted IIS.

The issue:

When I run the app on my dev computer, the maximum commit charge is about 1.5GB. The biggest user, measured by Task Manager's VM Size, is WebDev.WebServer.exe (600MB). The app runs perfectly.

When I run it on my rent-a-server (IIS 7.5, 1GB RAM), the maximum commit charge is over 3.8GB. The biggest user is w3wp.exe at 2.7GB. IIS grinds to a halt and spits out a timed-out error page.

Given my limited server budget and the hope of having multiple simultaneous users, I'm kind of in a panic.

Is this normal? If I bump the server RAM up to 4GB, will that be enough?

View 3 Replies

Configuration :: IIS Memory Usage Is Extreme - Is That Normal

Jan 6, 2011

I have an ASP.NET 3.5 app that collects data from a handful of external pages, parses the relevant bits and displays them in a table. Total data retrieved is 3-4MB and the resulting page is about 1MB. I am using synchronous WebRequest GetResponse for the retrieval, but the same problem existed using an asynchronous BeginGetResponse/EndGetResponse process.

There is no database access, no session storage, but an in-memory list of about 100 objects/1MB of data, plus a good amount of AJAX (AjaxControlToolkit). This issue appears on the very first run of the app, even if I have restarted IIS.

The issue:

When I run the app on my dev computer, the maximum commit charge is about 1.5GB. The biggest user, measured by Task Manager's VM Size, is WebDev.WebServer.exe (600MB). The app runs perfectly.

When I run it on my rent-a-server (IIS 7.5, 1GB RAM), the maximum commit charge is over 3.8GB. The biggest user is w3wp.exe at 2.7GB. IIS grinds to a halt and spits out a timed-out error page.

Given my limited server budget and the hope of having multiple simultaneous users, I'm kind of in a panic.

View 3 Replies







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