Solved

Linq to SQL Using  single sp for insert and update

Posted on 2010-09-11
3
522 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
[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
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

710 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