Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can i see execute command in Entity FrameWork ?

Posted on 2010-08-23
6
Medium Priority
?
1,530 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 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Amazon Web Services EC2 Cheat Sheet

AWS EC2 is a core part of AWS’s cloud platform, allowing users to spin up virtual machines for a variety of tasks; however, EC2’s offerings can be overwhelming. Learn the basics with our new AWS cheat sheet – this time on EC2!

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
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…

670 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