My asp code,
SqlParameter[] paramdizi2 = new SqlParameter[3]
{
new SqlParameter("@UserId";,SqlDbType.UniqueIdentifier),
new SqlParameter("@RolId";,SqlDbType.UniqueIdentifier),
new SqlParameter("@Sonuc";,SqlDbType.Int)
};
paramdizi2[0].Value = new Guid(TxtUserId.Text);
paramdizi2[1].Value = new Guid(TxtRolId.Text);
paramdizi2[2].Direction = ParameterDirection.Output;
baglan.ExecuteNonQuery("RolDuzenle";, CommandType.StoredProcedure, paramdizi2);
if (paramdizi2[2].Value.ToString() == "0";)
{
LabelDurum.Text = "No roleId";
}
else
{
LabelDurum.Text = "role ıd updated";
}
}
My stored procedure is now,
ALTER proc [dbo].[RolDuzenle]
(
@UserId uniqueidentifier,
@RolId uniqueidentifier,
@Sonuc int output
)
as
Declare @KayitKontrol int
Set @KayitKontrol=(select count(*) from dbo.aspnet_UsersInRoles where UserId=@UserId and RoleId=@RolId)
update dbo.aspnet_UsersInRoles set RoleId=@RolId where UserId=@UserId
if(@Kayitkontrol=0)
begin
set @Sonuc=0
end
else
begin
set @Sonuc=1
end
return @Sonuc
Thank u for your answer but my problem is going ...
i wrote your sp and changed my aspx code but my program was failed.
Rol ıd RolName
9acf74a8-d48b-4541-815e-695117a7a093 Admin
88299f05-b2aa-41c2-81f5-69959777677c AltinUye
5712cd36-406c-490e-9da0-235fcec32186 NormalUye
if ı write 11111111-d48b-4541-815e-695117a7a093 in txtRolId
my program was failed.
i want to write Not acceptRoleId in labeldurum
but how my problem is going:(