Click here to Skip to main content
15,906,567 members

Comments by Akashjoshi (Top 7 by date)

Akashjoshi 5-Nov-14 3:29am View    
you just used session over their...
Akashjoshi 5-Nov-14 2:12am View    
Deleted
see solution
Akashjoshi 3-Nov-14 23:52pm View    
Deleted
it's not proper way ...
we can not use IF-Else over their
Akashjoshi 3-Nov-14 23:49pm View    
Use this procedure..

create procedure Email_insert_procedure(@Id int, @Email varchar(100))as
insert into Email values ((select Id from contact WHERE Id=@Id), @Email)
Akashjoshi 3-Nov-14 23:26pm View    
cmd.Parameters.Add("@Id", SqlDbType.Int).Value = "125";
cmd.Parameters.Add("@Email", SqlDbType.VarChar).Value = "Mr";

Here you add 125 as a ID
so in insert procedure first it checks that
insert into Email VALUES((select id from contact WHERE Id=125),@email)
If this condition is true then id is inserted into your Email table..
and if condition is wrong then id does't inserted...because ID=125 is not in contact table...