Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can i see execute command in Entity FrameWork ?

Posted on 2010-08-23
6
Medium Priority
?
1,542 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 64

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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 64

Expert Comment

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

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 64

Accepted Solution

by:
Fernando Soto earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

916 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