Results 1 to 2 of 2

Thread: Parent\Child Tables

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    61

    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());

  2. #2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width