Category Archives: Entity Framework

[RESOLVED] how to tell if any textboxes or dropdownlists have been changed

I have a form that can be used to input new records, or to review previously entered records...  What is the best way to tell if any of the fields have been updated?  I have a fairly sized relational DB and I hate to update every associated record in every table every time the update button is pressed.  Is there possibly some way to tell on the server side or on the clientside via JavaScript?

This has to be a common problem with a good efficient solution.  Anybody have any thoughts here?

there are lots of options but it depends on your feasibility

1. entity framework

use entity framework, persist your object untill all the operation done on your page, and then you can save all together whenever you wants.

 

2. xml http request

make xml asynchronous http request to save the record in db, so there will be no postback on page or flickering

 

Thanks everyone for your suggestions.  What ended up working best in my case and had the easiest learning curve was using an asp:HiddenField for each field that I was tracking which had a default value of 0.  Then if the associated hidden field's value was changed (used each control's OnChange event) I set the associated hiddenfield's value to 1.  Then in the codebehind I could see what fields changed and act accordingly.

[RESOLVED] Upload Large Excel File

i have a large excel file which has 1 lakh row , i want to insert these data in my table i am using entity framework for insert but it takes more than

45 minutes to insert which is too much, i want to speed up the uploading process what should i do.

can I use multithreading for it if yes then how i can use ?

if any other way to do this process then please suggest

 

Thanks

Manish Chandra kumar

Hi,

Please read this blog. This will help you.

http://blog.sqlauthority.com/2008/01/08/sql-server-2005-export-data-from-sql-server-2005-to-microsoft-excel-datasheet/

You can create a stored procedure and pass the Excel Path. This will more faster rather for loop.

Regards

Shwetamber Chourey

India

[RESOLVED] * Easy to Save Edit Delete data (ASPX with SQL)

Dear Friends,

I have my project in ASPX 2008 with SQL server 2008, i'm using storeprocudures(SP) for updatating my data, its good one method to updation, but it takes too much of time for writing SP's... what is the latest method for updation my data, modification & deletion data... (give me few examples with videos, if possible). shall i use Linq or limda methodes for this save/edit/delete data ... please give me any one your suggestion&details...

Thanking you,

Ayyappan.cnn

You can use Entity Framework, nHibernate or other ORM.

Check this:

http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx

http://www.hanselman.com/blog/SimpleCodeFirstWithEntityFramework4MagicUnicornFeatureCTP4.aspx

[RESOLVED] GridView Updating Without Database Commitment

First off I'm using VS 2008 C# (3.5 Framework) and Linq2Sql for ORM. I have a gridview that represents a SQL database table. I want a users to be able to double-click the rows and get the edit items then be able to edit them and move on without them committing the changes to the database until the user clicks the save button. I know how to make the gridview work and all, my issue is that currently I'm having to keep session objects for the table data and edit them as opposed to a Linq2SQL datasource (because that seems to always automatically commit the change to the database). Also, I'm having trouble getting the changes in the edit controls to reflect in my session data objects. Does anyone have any great working examples of doing this type of work in a gridview. I know there are a lot, but I don't see any with Linq2SQL and not committing changes to the database immediately. Sorry I'm usually a back system developer, so I'm not a UI guru. Thanks.

I don't really have an example for you, but you will have to cache the in the session.  As long as you somehow track the changes you have made to your data set, running all of the update/insert/delete queries shouldn't be much of an issue.  Maybe you should look into entity framework.  I have seens some similar things in the past with this.

Good luck.

[RESOLVED] Too many problems with asp.net 4.0 routing

I am making a project using asp.net 4.0 and entity framework. I have implemented the routing feature introduced with asp.net 4.0.

There have been too many issues that I have faced with it.

The most common one is the use of javascript. We are disallowed from using the javascript code from anywhere else other than the scriptmanager.

As a result i found it very difficult to place the script manager in the master page, as there were too many javascript files and their order was difficult to maintain.

Also there were issues with the use of AJAX.

Then there were the hyperlinks and image tags (had to use tilda everywhere etc).

 

But the most weired problem that I faced was and I am yet to resolve it is the issue of Page loading multiple times.

Can anyone tell me how to detect the reason for page loading multiple times and also sometimes few events go into infinite loop.

Also if anyone can help with resources to understand the routing feature thoroughly.

The routing feature is fantastic but I think it is still a bit immature. May be we may see improvements in the future versions of Asp.Net

I think routing is fairly stable and it certainly meets the most common needs.

Having too many javascript files isn't really the problem of ASP.NET, let alone routing; you can combine scripts if it's an issue.

Page loading multiple times is not a routing issue either, but it may seem to be that way. You need to look at the requests (use Fiddler, or even the Net tab in Firebug); things like empty image sources can call the default page because there's no target URL, the domain is used, which in turn means the default document.

Infinite loops? I'd be very surprised if ASP.NET could generate that itself. Again it boils down to requests; what's being requested? Is it running through the routing engine? Is your route target calling something else?

I am unable to understand the automatic multiple page loads (same page loading multiple times) using firebug. Is there a dedicated tool to find just which request is causing the page load. I also read a few firebug tutorials specifically for the 'Net' tab, but did not get any head way.

I haven't seen any explicit tutorials. I just use the net tab to view the requests, so it allows me to see if there's a request for the domain/page itself, rather than a resource (eg image file). Another tool i use if Fiddler (http://www.fiddler2.com/fiddler2/); a free http proxy.

Another thing I supopse you could do is just to breakpoint on page load and examine Request.Url and Referrer, to see what's being requested and where from.