alter proc Proc_UpdateInfomation(@C_ID varchar(50),@State int output)
as
begin
declare @Tran varchar(50)
set @State=0
begin tran @Tran
delete from companyinfo where C_ID=@C_ID
if @@error<>0 or @@rowcount>1
begin
rollback tran @Tran
set @State=0
end
delete from EnterpriseContent where C_ID=@C_ID
if @@error<>0 or @@rowcount>1
begin
rollback tran @Tran
set @State=0
end
insert into companyinfo([C_ID],[CompanyName],[GenderID],[Introduce],[LogoPath],[CompanyPath],[PurchaseProduct],[MainProduct],[DealType],[CompanyType],[Sort],[SortOrder],[regMoney],[regTime],[regPlace],[CompanyAdderss],[FoundTime],[PPerson],[PSex],[PDept],[PDuty],[PAddress],[PZip],[PTel],[PEmail],[PPhone],[PMobile],[PFax],[PQQ],[PMSN],[PWebSite],[KeyWord],[KeyStartTime],[KeyEndTime],[AddTime],[Scores],[Award],[IsPass],[PassTime],[PassAdmin],[OpenedMonth],[IsPayment],[isdelete]) select [C_ID],[CompanyName],[GenderID],[Introduce],[LogoPath],[CompanyPath],[PurchaseProduct],[MainProduct],[DealType],[CompanyType],[Sort],[SortOrder],[regMoney],[regTime],[regPlace],[CompanyAdderss],[FoundTime],[PPerson],[PSex],[PDept],[PDuty],[PAddress],[PZip],[PTel],[PEmail],[PPhone],[PMobile],[PFax],[PQQ],[PMSN],[PWebSite],[KeyWord],[KeyStartTime],[KeyEndTime],[AddTime],[Scores],[Award],[IsPass],[PassTime],[PassAdmin],[OpenedMonth],[IsPayment],[isdelete] from UpdateCompanyInfo where C_ID=@C_ID
if @@error<>0 or @@rowcount>1
begin
rollback tran @Tran
set @State=0
end
insert into EnterpriseContent([C_ID],[LegalPerson],[DeveloperNum],[WorkerNum],[InCome],[MainMarket],[MainPlace],[IsOem],[PlantArea],[BrandName],[Turnover],[Import],[Export],[QualityControl],[ManagementSystem],[OurBank],[BankAccount]) select [C_ID],[LegalPerson],[DeveloperNum],[WorkerNum],[InCome],[MainMarket],[MainPlace],[IsOem],[PlantArea],[BrandName],[Turnover],[Import],[Export],[QualityControl],[ManagementSystem],[OurBank],[BankAccount] from UpdateCompanyInfo where C_ID=@C_ID
if @@error<>0 or @@rowcount>1
begin
rollback tran @Tran
set @State=0
end
delete from UpdateCompanyInfo where C_ID=@C_ID
if @@error<>0 or @@rowcount>1
begin
rollback tran @Tran
set @State=0
end
if @@error=0 and @@rowcount>0
begin
commit tran @Tran
set @State=1
end
else
begin
rollback tran @Tran
set @State=0
end
end
go