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

x
?
Solved

Linq to SQL Using  single sp for insert and update

Posted on 2010-09-11
3
Medium Priority
?
524 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 64

Accepted Solution

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

Expert Comment

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

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

722 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