i m using a gridview which is binded. i want to delete rows from multiple tables . i m able to delete from one table using delete command but not for multiple tables.
can anyone help me.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Santhosh Kumar JayaramanPosted Sep 10, 2012, 7:18 AM
Muhammad younasPosted Sep 10, 2012, 7:17 AM
Santhosh Kumar JayaramanPosted Sep 10, 2012, 5:10 AM
(id int primary key,
name varchar(10)
)
create table EMpROle
(id int primary key,
Role varchar(10),
foreign key (id) references emp(id) on delete cascade )
insert into emp values (1,'A')
insert into emp values (2,'AA')
insert into emp values (3,'AAA')
insert into EMpROle values(1,'Manager')
insert into EMpROle values(2,'Accountant')
insert into EMpROle values(3,'Director')
--you can see 3 rows
select * from emprole
--am deleting only from table emp
delete from emp where id=3
--Now only 2 rows
select * from emprole