Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How can i see execute command in Entity FrameWork ?

Posted on 2010-08-23
6
1,501 Views
Last Modified: 2013-11-11

i try to use erpCtx.Executecommand but i doesn't have method of executecommand. i think that i must add dll in Reference to show executeCommand?

Look please :  http://i33.tinypic.com/rs4gm1.jpg

i need : int rowsAffected = engCtx.ExecuteCommand("insert into ENG_MAINWP Values({0},{1},{2},{3})", engArray[0], engArray1, engArray[2], engArray[3]);


0
Comment
Question by:programmerist
  • 4
  • 2
6 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 33501130
Hi programmerist;

In the Entity Framework you use the ExecuteStoreCommand located in the System.Data.Entity namespace.

Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public int ExecuteStoreCommand(
      string commandText,
      params Object[] parameters
)

The following should do it.

int rowsAffected = engCtx.ExecuteStoreCommand("insert into ENG_MAINWP Values({0},{1},{2},{3})",  engArray);

Fernando
0
 

Author Comment

by:programmerist
ID: 33501885
i writed your codes but ExecuteStoreCommand can not display in intellisense...
0
 

Author Comment

by:programmerist
ID: 33501896
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 63

Expert Comment

by:Fernando Soto
ID: 33502196
Did you add the reference to the the dll -> System.Data.Entity?
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 33502828
Hi programmerist;

If you are NOT using Entity Framework 4 in your project then what I have posted above will NOT work. Let me know what version of the Entity Framework you are using, Meanwhile I will look at how to implement it in 3.5.

Fernando
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 33503369
Hi programmerist;

From Microsoft Documentation:
How Entity SQL Differs from Transact-SQL
http://msdn.microsoft.com/en-us/library/bb738573.aspx
Entity SQL  currently provides no support for DML statements (insert, update, delete).

So it can NOT be done with eSQL, Entity SQL, and Linq to Entity does not have a method to do this in version 3.5, so you will not be able to do this if you are using version 3.5. In version 4 of Entity Frame that functionality was added.

Fernando
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question