-
Parent\Child Tables
How can I ensure that the currently selected row ID in Parent Table automatically appears in my child form when I create a new row in the Child Form.
I am using VB 2008 Express
I have a Stored Procedure for the chiled table called "Files" can I do it from there:-
Code:
ALTER PROCEDURE dbo.CreateFile
(
@FileName varchar(50),
@DateCreated varchar(50),
@CreatedBy varchar(50),
@Filetype varchar(50),
@Folder varchar(50),
@FileClassification varchar(50),
@Re varchar(50),
@Modified Timestamp OUTPUT,
@FileID int OUTPUT,
@FolderID int OUTPUT
)
AS
SET NOCOUNT ON
-- Inserts New Row
INSERT INTO Files
( FileName, DateCreated, CreatedBy, Filetype, Folder, FileClassification, Re, FolderID )
VALUES
( @FileName, @DateCreated, @CreatedBy, @Filetype, @Folder, @FileClassification, @Re, @FolderID );
IF @@ROWCOUNT>0 AND @@ERROR=0 -- Checks if Last Statement Produced an Error
--
SELECT @FileID = FileID,
@Modified = Modified,
@FolderID = FolderID
FROM Files
WHERE (FileID = SCOPE_IDENTITY());
-
Re: Parent\Child Tables
this post should be in the database development forum