Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
i have table: 1)user
fields:name,
address,
mob,
log_id
 
2)login
fields:log_id
username,
password
 
when i update or delete record from user table ,update or delete record from login table also done.
i have to use store procedure for that.I don't know how to update,delete records using store procedure in multiple table.
Posted 20-Jan-13 4:16am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can turn on Cascade Delete [^] which will allow you to allow you to delete foreign key rows.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
It would help if we knew what fields you have available on update or delete, but here I will assume you have al the fields in the user table.
 
For Update
 
Create Procedure ProcUpdateUser()
@logid int,
@name varchar(50)
 
as 
begin
update user set name=@name where log_id=@logid
update login set username=@name where log_id=@logid
 
end
 
For Delete
 
Create Procedure ProcDeleteUser
 
@name varchar(50)
 
as
begin
delete user where name=@name
delete login where username=@name
 
end
 

You will need to change the parameters according to your needs but hope this helps.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.150224.1 | Last Updated 20 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100