Hi Everibody
MTrinder wrote:
Does it work correctly if you add the card to the contact outside of the validation routine ?
yes it's work perfect that way, but i want the Card to create on every contact i save, so i think the validator is the best place to put it, or not?
this is the sql generated.
This one is when a Create the card inside the validator
declare @p3 int
set @p3=NULL
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Contacts] ([Name], [Tel], [AuthCode]) VALUES (@Name, @Tel, @AuthCode);SELECT @ContactId=SCOPE_IDENTITY()',N'@ContactId int output,@Name varchar(50),@Tel varchar(50),@AuthCode varchar(50)',@ContactId=@p3 output,@Name='Jack',@Tel='345345',@AuthCode='87687hjhkjhkjhk'
select @p3
declare @p3 int
set @p3=4
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Contacts] ([Name], [Tel], [AuthCode]) VALUES (@Name, @Tel, @AuthCode);SELECT @ContactId=SCOPE_IDENTITY()',N'@ContactId int output,@Name varchar(50),@Tel varchar(50),@AuthCode varchar(50)',@ContactId=@p3 output,@Name='Jack',@Tel='345345',@AuthCode='87687hjhkjhkjhk'
select @p3
declare @p3 int
set @p3=NULL
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Locations] ([Name], [ContactID]) VALUES (@Name, @ContactId);SELECT @LocationId=SCOPE_IDENTITY()',N'@LocationId int output,@Name varchar(50),@ContactId int',@LocationId=@p3 output,@Name='My Place',@ContactId=4
select @p3
declare @p3 int
set @p3=3
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Locations] ([Name], [ContactID]) VALUES (@Name, @ContactId);SELECT @LocationId=SCOPE_IDENTITY()',N'@LocationId int output,@Name varchar(50),@ContactId int',@LocationId=@p3 output,@Name='My Place',@ContactId=4
select @p3
declare @p3 int
set @p3=NULL
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Locations] ([Name], [ContactID]) VALUES (@Name, @ContactId);SELECT @LocationId=SCOPE_IDENTITY()',N'@LocationId int output,@Name varchar(50),@ContactId int',@LocationId=@p3 output,@Name='My Apt',@ContactId=4
select @p3
declare @p3 int
set @p3=4
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Locations] ([Name], [ContactID]) VALUES (@Name, @ContactId);SELECT @LocationId=SCOPE_IDENTITY()',N'@LocationId int output,@Name varchar(50),@ContactId int',@LocationId=@p3 output,@Name='My Apt',@ContactId=4
select @p3
This One is when i create the card on the webform
declare @p3 int
set @p3=NULL
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Contacts] ([Name], [Tel], [AuthCode]) VALUES (@Name, @Tel, @AuthCode);SELECT @ContactId=SCOPE_IDENTITY()',N'@ContactId int output,@Name varchar(50),@Tel varchar(50),@AuthCode varchar(50)',@ContactId=@p3 output,@Name='Bauer',@Tel='8874095',@AuthCode='87687hjhkjhkjhk'
select @p3
declare @p3 int
set @p3=5
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Contacts] ([Name], [Tel], [AuthCode]) VALUES (@Name, @Tel, @AuthCode);SELECT @ContactId=SCOPE_IDENTITY()',N'@ContactId int output,@Name varchar(50),@Tel varchar(50),@AuthCode varchar(50)',@ContactId=@p3 output,@Name='Bauer',@Tel='8874095',@AuthCode='87687hjhkjhkjhk'
select @p3
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Cards] ([CardID], [CreatedBy]) VALUES (@CardId, @CreatedBy)',N'@CardId int,@CreatedBy varchar(50)',@CardId=5,@CreatedBy='me'
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Cards] ([CardID], [CreatedBy]) VALUES (@CardId, @CreatedBy)',N'@CardId int,@CreatedBy varchar(50)',@CardId=5,@CreatedBy='me'
declare @p3 int
set @p3=NULL
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Locations] ([Name], [ContactID]) VALUES (@Name, @ContactId);SELECT @LocationId=SCOPE_IDENTITY()',N'@LocationId int output,@Name varchar(50),@ContactId int',@LocationId=@p3 output,@Name='My SUV',@ContactId=5
select @p3
declare @p3 int
set @p3=5
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Locations] ([Name], [ContactID]) VALUES (@Name, @ContactId);SELECT @LocationId=SCOPE_IDENTITY()',N'@LocationId int output,@Name varchar(50),@ContactId int',@LocationId=@p3 output,@Name='My SUV',@ContactId=5
select @p3
declare @p3 int
set @p3=NULL
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Locations] ([Name], [ContactID]) VALUES (@Name, @ContactId);SELECT @LocationId=SCOPE_IDENTITY()',N'@LocationId int output,@Name varchar(50),@ContactId int',@LocationId=@p3 output,@Name='My dog',@ContactId=5
select @p3
declare @p3 int
set @p3=6
exec sp_executesql N'INSERT INTO [TestDB].[dbo].[Locations] ([Name], [ContactID]) VALUES (@Name, @ContactId);SELECT @LocationId=SCOPE_IDENTITY()',N'@LocationId int output,@Name varchar(50),@ContactId int',@LocationId=@p3 output,@Name='My dog',@ContactId=5
select @p3
Thank in advance!