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
Solved

Linq to SQL Using  single sp for insert and update

Posted on 2010-09-11
3
520 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 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 33655592
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
ID: 33655594
Sounds good to me,
Thanks
0
 
LVL 63

Expert Comment

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

Featured Post

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.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

792 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