USE [RahgoshafanDB]GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
CREATE PROCEDURE Category_Insert
@Category NVARCHAR(MAX),
@Toz NVARCHAR(MAX)
AS
BEGIN
INSERT INTO Category(Category, Toz)
VALUES (@Category, @Toz)
END
using
System;
System.Data;
System.Data.SqlClient;
namespace
DAL
{
public
class
Category_Dal
SqlConnection SqlCon =
new
SqlConnection(
"Data Source=.;Initial Catalog=RahgoshafanDB;Integrated Security=True"
);
int
id;
void
Category_Insert()
try
SqlCommand cmd =
SqlCommand(
"Category_Insert"
, SqlCon);
cmd.CommandType = CommandType.StoredProcedure;
SqlCon.Open();
cmd.ExecuteNonQuery();
}
finally
if
(SqlCon.State != ConnectionState.Closed)
SqlCon.Close();