USE [Basicsite]
GO
/****** 개체: StoredProcedure [dbo].[upsUpPoll] 스크립트 날짜: 01/28/2009 11:22:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DB단
CREATE PROC [dbo].[upsUpPoll]
@Writer nvarchar(50),
@Question nvarchar(256),
@sDate char(8),
@eDate char(8),
@itemCount tinyint,
@PollId int
AS
UPDATE t_poll SET
Writer = @Writer ,
Question = @Question ,
sDate = @sDate ,
eDate = @eDate ,
PollTotal = 0,
ItemCount = @itemCount
WHERE PollId = @PollId ;
코드단
string upsUpPoll = "upsUpPoll";
SqlCommand cmd = new SqlCommand(upsUpPoll, conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Writer", writer);
cmd.Parameters.AddWithValue("@Question", question);
cmd.Parameters.AddWithValue("@sDate", sDate);
cmd.Parameters.AddWithValue("@eDate", eDate);
cmd.Parameters.AddWithValue("@itemCount", itemCount);
cmd.Parameters.AddWithValue("@PollId", pollId);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();