i have some experience on that thing...some logical error maybe..
coz it works perfectly on different login id that i always use..
i use store procedure and maybe it got some error in it..
please let me know if it have some
here the select for record that make me got error either bof or eof true or either record has been deleted...like that
and some other to check login
coz it works perfectly on different login id that i always use..
i use store procedure and maybe it got some error in it..
please let me know if it have some
here the select for record that make me got error either bof or eof true or either record has been deleted...like that
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER procedure [dbo].[select_Peribadi]
(
@Personel_No varchar(8),
@typesp int
)
as
/*DECLARE @myERROR int -- Local @@ERROR
, @myRowCount int -- Local @@ROWCOUNT*/
SET NOCOUNT ON
if (@typesp='1')
begin
SELECT tblperibadi.Personel_No,tblPeribadi.Nama,tblCompany.Keterangan as Company_Code, tblPeribadi.Jawatan, tblPeribadi.Taraf_Jawatan,
tblGroup.Keterangan AS Kumpulan,tblPeribadi.Gred,tblBusiness_Area.Keterangan AS Business_Area,tblCost_Center.Keterangan AS Kod_Pusat_Kos, tblPeribadi.IC_Baru, tblPeribadi.IC_Lama,
tblPeribadi.Jantina, tblPeribadi.BumiStatus,
CAST(DAY(tblPeribadi.Tarikh_Lahir) AS VARCHAR(2)) + ' ' + DATENAME(MM, tblPeribadi.Tarikh_Lahir) + ' ' + CAST(YEAR(tblPeribadi.Tarikh_Lahir) AS VARCHAR(4)) AS [Tarikh_Lahir],
tblPeribadi.Tempat_Lahir,TblCountry.CDesc as Negara_Kelahiran, tblstate.Statedesc as Negeri_Kelahiran,
tblMaritulStatus.MarStat as Taraf_Perkahwinan,
CAST(DAY(tblPeribadi.Tarikh_Perkahwinan) AS VARCHAR(2)) + ' ' + DATENAME(MM,tblPeribadi.Tarikh_Perkahwinan) + ' ' + CAST(YEAR(tblPeribadi.Tarikh_Perkahwinan) AS VARCHAR(4)) AS [Tarikh_Perkahwinan],
tblreligious.Rel_Denomination as Agama, tblEthnic.EthnicDesc as Bangsa, tblPeribadi.No_EPF, tblPeribadi.No_Socso,
tblPeribadi.No_Tax, tblPeribadi.Email
FROM tblPeribadi INNER JOIN
tblCompany ON tblPeribadi.Company_Code=tblCompany.Company_Code INNER JOIN
tblGroup ON tblPeribadi.Kumpulan = tblGroup.Kumpulan INNER JOIN
tblBusiness_Area ON tblPeribadi.Business_Area = tblBusiness_Area.Business_Area INNER JOIN
tblCost_Center ON tblPeribadi.Kod_Pusat_kos = tblCost_Center.Kod_Pusat_Kos LEFT JOIN
TblCountry ON tblPeribadi.Negara_Kelahiran = TblCountry.CShort LEFT join
tblstate on tblPeribadi.Negeri_Kelahiran=tblstate.region LEFT join
tblMaritulStatus on tblPeribadi.Taraf_Perkahwinan=tblMaritulStatus.MarCode LEFT join
tblreligious on tblPeribadi.Agama=tblreligious.relcode LEFT join
tblethnic on tblPeribadi.Bangsa=tblEthnic.EthnicCode
where tblperibadi.Personel_No=@Personel_No
/*SELECT @myERROR = @@ERROR, @myRowCount = @@ROWCOUNT
IF @myERROR != 0 GOTO HANDLE_ERROR*/
end
if (@typesp='2')
begin
SELECT tblPeribadi.Personel_No, tblPeribadi.Nama,tblCompany.Keterangan as Company_Code, tblPeribadi.Jawatan, tblPeribadi.Taraf_Jawatan,
tblGroup.Keterangan AS Kumpulan,tblPeribadi.Gred,tblBusiness_Area.Keterangan AS Business_Area,tblCost_Center.Keterangan AS Kod_Pusat_Kos, tblPeribadi.IC_Baru, tblPeribadi.IC_Lama,
tblPeribadi.Jantina, tblPeribadi.BumiStatus,
CAST(DAY(tblPeribadi.Tarikh_Lahir) AS VARCHAR(2)) + ' ' + DATENAME(MM, tblPeribadi.Tarikh_Lahir) + ' ' + CAST(YEAR(tblPeribadi.Tarikh_Lahir) AS VARCHAR(4)) AS [Tarikh_Lahir],
tblPeribadi.Tempat_Lahir,tblPeribadi.Negara_Kelahiran, tblPeribadi.Negeri_Kelahiran,
tblPeribadi.Taraf_Perkahwinan,
CAST(DAY(tblPeribadi.Tarikh_Perkahwinan) AS VARCHAR(2)) + ' ' + DATENAME(MM,tblPeribadi.Tarikh_Perkahwinan) + ' ' + CAST(YEAR(tblPeribadi.Tarikh_Perkahwinan) AS VARCHAR(4)) AS [Tarikh_Perkahwinan],
tblPeribadi.Agama, tblPeribadi.Bangsa, tblPeribadi.No_EPF, tblPeribadi.No_Socso,
tblPeribadi.No_Tax, tblPeribadi.Email
FROM tblPeribadi INNER JOIN
tblCompany ON tblPeribadi.Company_Code=tblCompany.Company_Code INNER JOIN
tblGroup ON tblPeribadi.Kumpulan = tblGroup.Kumpulan INNER JOIN
tblBusiness_Area ON tblPeribadi.Business_Area = tblBusiness_Area.Business_Area INNER JOIN
tblCost_Center ON tblPeribadi.Kod_Pusat_kos = tblCost_Center.Kod_Pusat_Kos
where tblperibadi.personel_no=@Personel_No
end
/*COMMIT TRAN
HANDLE_ERROR:
ROLLBACK TRAN
RETURN @myERROR*/
/*Done by Rahmat*/
Code:
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[get_user] ( @user_id varchar(8), @pwd varchar(12), @level char(1) OUTPUT ) AS IF EXISTS(SELECT Personel_No From TblUser_ID where Personel_No = @user_id) BEGIN IF EXISTS(SELECT Personel_No From TblUser_ID where Personel_No = @user_id AND Password = @pwd) BEGIN SET @level=(SELECT Levels FROM tblUser_ID WHERE Personel_No = @user_id AND Password = @pwd) INSERT INTO TblAudit_Trails(Personel_No,IC_Baru,Business_Area) SELECT Personel_No,IC_Baru,Business_Area From TblPeribadi where Personel_No = @user_id AND IC_Baru = @pwd IF EXISTS(SELECT IC_Baru From TblPeribadi where Personel_No = @user_id AND IC_Baru = @pwd) BEGIN RETURN(4) END ELSE RETURN(3) END ELSE SET @level='0' RETURN(1) END ELSE BEGIN IF EXISTS(SELECT Personel_No From TblPeribadi where Personel_No = @user_id) BEGIN IF EXISTS(SELECT Personel_No From TblPeribadi where Personel_No = @user_id AND IC_Baru = @pwd) BEGIN INSERT INTO TblUser_ID(Personel_No,Password,Update_By) VALUES(@user_id,@pwd,@user_id) INSERT INTO TblAudit_Trails(Personel_No,IC_Baru,Business_Area) SELECT Personel_No,IC_Baru,Business_Area From TblPeribadi where Personel_No = @user_id AND IC_Baru = @pwd SET @level='4' RETURN(4) END ELSE SET @level='0' RETURN(2) END ELSE SET @level='0' RETURN(0) END /*Done by Rahmat*/
Comment