5. 게시판의 글 작성 페이지인 BoardWrite.aspx에서 사용할 저장 프로시저 구문을 다음과 같이 작성한다. 저장 프로시저 이름은 WriteNote이지만, 파일명은 DNN_WriteNote.sql로 작성되었다.

    ▼  /dbo/Stored Procedures/DotNetNote/DNN_WriteNote.sql

    –[1] 게시판(DotNetNote)에 글을 작성 : WriteNote
    Create Proc dbo.WriteNote
      @Name       NVarChar(25),
      @Email      NVarChar(100),
      @Title      NVarChar(150),
      @PostIp     NVarChar(15),
      @Content    NText,
      @Password   NVarChar(20),
      @Encoding   NVarChar(10),
      @Homepage   NVarChar(100),
      @FileName   NVarChar(255),
      @FileSize   Int
    As
      Declare @MaxRef Int
      Select @MaxRef = Max(Ref) From Notes
      
      If @MaxRef is Null
          Set @MaxRef = 1  테이블 생성 후 처음만 비교
      Else
          Set @MaxRef = @MaxRef + 1
      
      Insert Notes
      (
          Name, Email, Title, PostIp, Content, Password, Encoding,
          Homepage, Ref, FileName, FileSize
      )
      Values
      (
          @Name, @Email, @Title, @PostIp, @Content, @Password, @Encoding,
          @Homepage, @MaxRef, @FileName, @FileSize
      )
    Go
    

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.