Solved

How can i see execute command in Entity FrameWork ?

Posted on 2010-08-23
6
1,510 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
[X]
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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Major Serverless Shift

Comparison of major players like AWS, Microsoft Azure, IBM Bluemix, and Google Cloud Platform

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

623 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