ASPX.CS Page
int Admin = ObjUser.insert_Admin(1, Convert.ToString(dropUserType.SelectedValue), Convert.ToString(txtUsername.Text));
BLL CLASS PAGE
public int insert_Admin(int OperatorId, string UserRoll, string UserName)
{
SqlParameter[] param = new SqlParameter[3];
param[0] = new SqlParameter("@OperatorId", SqlDbType.Int);
param[0].Direction = ParameterDirection.Input;
param[0].Value = OperatorId;
param[1] = new SqlParameter("@UserRoll", SqlDbType.VarChar,200);
param[1].Direction = ParameterDirection.Input;
param[1].Value = UserRoll;
param[2] = new SqlParameter("@UserName", SqlDbType.VarChar, 200);
param[2].Direction = ParameterDirection.Input;
param[2].Value = UserName;
int dt = objdb.Insert_Update_Del("sp_Master_User", param);
return dt;
}
DLL CLASS PAGE
public Int32 Insert_Update_Del(string SP_Name, SqlParameter[] param)
{
DoConnection();
SqlCommand cmd = new SqlCommand(SP_Name, Con);
cmd.CommandType = CommandType.StoredProcedure;
if (param.Length > 0)
{
for (int i = 0; i < param.Length; i++)
{
cmd.Parameters.Add(param[i]);
}
}
Int32 intvel = cmd.ExecuteNonQuery();
return intvel;
}
STORE PROCEDURE IN SQL SERVER
CREATE PROCEDURE [dbo].[sp_Master_User]
@OperatorId int = NULL ,
@UserRoll(200) = NULL,
@UserName(200) = NULL
AS
BEGIN
if @OperatorId = 1
begin
insert into dbo.Master_User
(
UserRoll,
UserName
)
values
(
@UserRoll,
@UserName
)
end
END
int Admin = ObjUser.insert_Admin(1, Convert.ToString(dropUserType.SelectedValue), Convert.ToString(txtUsername.Text));
BLL CLASS PAGE
public int insert_Admin(int OperatorId, string UserRoll, string UserName)
{
SqlParameter[] param = new SqlParameter[3];
param[0] = new SqlParameter("@OperatorId", SqlDbType.Int);
param[0].Direction = ParameterDirection.Input;
param[0].Value = OperatorId;
param[1] = new SqlParameter("@UserRoll", SqlDbType.VarChar,200);
param[1].Direction = ParameterDirection.Input;
param[1].Value = UserRoll;
param[2] = new SqlParameter("@UserName", SqlDbType.VarChar, 200);
param[2].Direction = ParameterDirection.Input;
param[2].Value = UserName;
int dt = objdb.Insert_Update_Del("sp_Master_User", param);
return dt;
}
DLL CLASS PAGE
public Int32 Insert_Update_Del(string SP_Name, SqlParameter[] param)
{
DoConnection();
SqlCommand cmd = new SqlCommand(SP_Name, Con);
cmd.CommandType = CommandType.StoredProcedure;
if (param.Length > 0)
{
for (int i = 0; i < param.Length; i++)
{
cmd.Parameters.Add(param[i]);
}
}
Int32 intvel = cmd.ExecuteNonQuery();
return intvel;
}
STORE PROCEDURE IN SQL SERVER
CREATE PROCEDURE [dbo].[sp_Master_User]
@OperatorId int = NULL ,
@UserRoll(200) = NULL,
@UserName(200) = NULL
AS
BEGIN
if @OperatorId = 1
begin
insert into dbo.Master_User
(
UserRoll,
UserName
)
values
(
@UserRoll,
@UserName
)
end
END