Solved

How can i see execute command in Entity FrameWork ?

Posted on 2010-08-23
6
1,492 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 62

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 62

Expert Comment

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

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 62

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now