Solved

Linq to SQL Using  single sp for insert and update

Posted on 2010-09-11
3
518 Views
Last Modified: 2013-11-11
Hi EE,

I have sps that besides including both insert and update code, they also call other sps.
Can I use sps like this with Linq to SQL.
If I can, how would I use it?
I am using sql server 2005.
Thanks
0
Comment
Question by:Sheritlw
  • 2
3 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
Comment Utility
Hi Sheritlw;

Yes you can, that should not be an issue.

First create your DataContext using the ORM design tool.
Drag the Stored Procedure onto the design surface, right side of the designer.
Now in code create an instance of the data context for example :

Dim db As New DataContextName()

Then execute the SP, let say the SP is called InsertAndUpdate, something like this :

db.InsertAndUpdate( "The parameters you need to pass in" )

thats it.

Fernando
0
 

Author Comment

by:Sheritlw
Comment Utility
Sounds good to me,
Thanks
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Not a problem, glad to help.  ;=)
0

Featured Post

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!

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 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

10 Experts available now in Live!

Get 1:1 Help Now