用ASP
下面就來個例子
CREATE PROCEDURE sp_AccountRole_Create@CategoryID int
@RoleName nvarchar(
@Description nvarchar(
@RoleID int output
AS
DECLARE @Count int
SELECT @Count = Count(RoleID) FROM Account_Role WHERE
RoleName = @RoleName
IF @Count =
INSERT INTO Account_Role
(CategoryID
(@CategoryID
SET @RoleID = @@IDENTITY
RETURN
執行存儲過程的C#過程
SqlConnection DbConnection = new SqlConnection(mConnectionString);
SqlCommand command = new SqlCommand(
DbConnection
// 廢置SqlCommand的屬性為存儲過程command
command
command
command
command
// 返回值command
SqlDbType
// Size
ParameterDirection
false
// is nullable
// byte precision
// byte scale
string
DataRowVersion
null );
command
command
command
// 可以返回新的ID值command
int rowsAffected = command
int result = command
功能挺強的吧
From:http://tw.wingwit.com/Article/program/ASP/201311/21750.html