我有一个存储过程将数据从安全数据库的各个表复制到租户数据库。 在我执行插入操作然后更新查询的过程中。这两个命令应该在每次执行时执行,但是当我执行该过程时,它不执行更新查询。这是我程序的结构:
COMPLETE SP:
ALTER PROCEDURE [ams].[usp_CopyMasterServiceDataToClient] @ServiceIDs [varchar] (max)
WITH EXECUTE AS CALLER
AS
BEGIN
DECLARE @ProcessID UNIQUEIDENTIFIER
DECLARE @Steps INT
SET @ProcessID = NEWID()
SET @STEPS = 1
EXEC usp_InsertServerProcessLog 'usp_CopyMasterServiceDataToClient'
,@Steps
,'Starting Procedure usp_CopyMasterServiceDataToClient'
,@ProcessID
,'Info'
BEGIN TRY
SELECT *
INTO #ServiceIDs
FROM ams.SplitDelimiterString(@ServiceIDs, ',')
SELECT BS.*
INTO #tmpBkgServices
FROM [AMS].[Syn_BackgroundService] AS BS
INNER JOIN #ServiceIDs AS SI ON BS.[BSE_ID] = SI.Item
WHERE BS.BSE_IsDeleted = 0
SELECT *
INTO #tmpBkgServicesWithChilds
FROM #tmpBkgServices
UNION
SELECT MBS.*
FROM #tmpBkgServices AS BS
INNER JOIN [AMS].[Syn_BackgroundService] AS MBS ON BS.[BSE_ID] = MBS.BSE_ParentServiceID
WHERE BS.BSE_IsDeleted = 0
SELECT #tmpBkgServicesWithChilds.BSE_ID AS Item
INTO #ServiceID
FROM #tmpBkgServicesWithChilds
--for storing the Mappings for BkgAttributeGroupMapping and BkgSvcAttributeGroupMapping based on Service IDs
SELECT *
INTO #tmpBkgAttrGrpAndBkgSvcAttrGrpMapping
FROM [AMS].[Syn_BackgroundService] AS BS
INNER JOIN [AMS].[Syn_BkgSvcAttributeGroupMapping] AS BPAGP ON BS.BSE_ID = BPAGP.BSAGM_ServiceId
AND BPAGP.BSAGM_IsDeleted = 0
INNER JOIN [AMS].[Syn_BkgAttributeGroupMapping] AS BSAGM ON BSAGM.BAGM_ID = BPAGP.BSAGM_AttributeGroupMappingID
AND BSAGM.BAGM_IsDeleted = 0
INNER JOIN #ServiceID AS SI ON BS.[BSE_ID] = SI.Item
WHERE BS.BSE_IsDeleted = 0
--For BkgSvcAttributes
SELECT DISTINCT [BSA_ID]
,[BSA_Name]
,[BSA_Description]
,[BSA_Label]
,[BSA_DataTypeID]
,[BSA_IsRequired]
,[BSA_ReqValidationMessage]
,[BSA_MaxIntValue]
,[BSA_MinIntValue]
,[BSA_MaxDateValue]
,[BSA_MinDateValue]
,[BSA_MaxLength]
,[BSA_MinLength]
,[BSA_IsEditable]
,[BSA_IsSystemPreConfiguredq]
,[BSA_Code]
,[BSA_CopiedFromCode]
,[BSA_IsDeleted]
,[BSA_CreatedById]
,[BSA_CreatedDate]
,[BSA_ModifiedBy]
,[BSA_ModifiedDate]
,[BSA_Active]
INTO #tmpBkgSvcAttributes
FROM #tmpBkgAttrGrpAndBkgSvcAttrGrpMapping AS BS
INNER JOIN [AMS].[Syn_BkgSvcAttribute] AS BSA ON BS.BAGM_BkgSvcAtributeID = BSA.BSA_ID
--AND BSA.BSA_Active = 1
AND BSA.BSA_IsDeleted = 0
--For BkgSvcAttributeOption
SELECT [EBSAO_ID]
,[EBSAO_BkgSvcAttributeID]
,[EBSAO_OptionText]
,[EBSAO_OptionValue]
,[EBSAO_IsDeleted]
,[EBSAO_IsActive]
,[EBSAO_CreatedByID]
,[EBSAO_CreatedOn]
,[EBSAO_ModifiedByID]
,[EBSAO_ModifiedOn]
INTO #tmpBkgSvcAttributeOption
FROM #tmpBkgSvcAttributes AS tmpBSA
INNER JOIN [AMS].[Syn_BkgSvcAttributeOption] AS BSAO ON tmpBSA.BSA_ID = BSAO.EBSAO_BkgSvcAttributeID
--AND BSAO.EBSAO_IsActive = 1
AND BSAO.EBSAO_IsDeleted = 0
--For BkgSvgAttributesGroup
SELECT DISTINCT [BSAD_ID]
,[BSAD_Name]
,[BSAD_Description]
,[BSAD_IsEditable]
,[BSAD_IsSystemPreConfigured]
,[BSAD_Code]
,[BSAD_CopiedFromCode]
,[BSAD_IsDeleted]
,[BSAD_CreatedById]
,[BSAD_CreatedDate]
,[BSAD_ModifiedBy]
,[BSAD_ModifiedDate]
--,[BSAD_IsRequired]
INTO #tmpBkgSvcAttributesGroup
FROM #tmpBkgAttrGrpAndBkgSvcAttrGrpMapping AS BS
INNER JOIN [AMS].[Syn_BkgSvcAttributeGroup] AS BSAG ON BSAG.BSAD_ID = BS.BAGM_BkgSvcAttributeGroupId
AND BSAG.BSAD_IsDeleted = 0
--For BackgroundServices
SELECT DISTINCT [BSE_ID]
,[BSE_Name]
,[BSE_Description]
,[BSE_SvcTypeID]
,[BSE_IsEditable]
,[BSE_IsSystemPreConfigured]
,[BSE_IsDeleted]
,[BSE_CreatedById]
,[BSE_CreatedDate]
,[BSE_ModifiedBy]
,[BSE_ModifiedDate]
,[BSE_ClientCount]
,[BSE_ParentServiceID]
INTO #tmpBackgroundServices
FROM #tmpBkgServicesWithChilds AS tmpBS
WHERE tmpBS.BSE_ID NOT IN (
SELECT CBS.BSE_ID
FROM ams.BackgroundService CBS
)
--For BkgAttributeGroupMapping
SELECT DISTINCT [BAGM_ID]
,[BAGM_BkgSvcAttributeGroupId]
,[BAGM_BkgSvcAtributeID]
,[BAGM_IsEditable]
,[BAGM_IsSystemPreConfigured]
,[BAGM_Code]
,[BAGM_CopiedFromCode]
,[BAGM_IsDeleted]
,[BAGM_CreatedBy]
,[BAGM_CreatedOn]
,[BAGM_ModifiedBy]
,[BAGM_ModifiedOn]
,[BAGM_IsDisplay]
,[BAGM_DisplaySequence]
,[BAGM_IsRequired]
INTO #tmpBkgAttributeGroupMapping
FROM #tmpBkgAttrGrpAndBkgSvcAttrGrpMapping AS tmpBAGBSG
WHERE tmpBAGBSG.BAGM_ID IS NOT NULL
AND tmpBAGBSG.BAGM_ID NOT IN (
SELECT CBAGM.BAGM_ID
FROM ams.BkgAttributeGroupMapping CBAGM
)
--For BkgAttributeGroupMapping - ALL ENTRIES
SELECT DISTINCT [BAGM_ID]
,[BAGM_BkgSvcAttributeGroupId]
,[BAGM_BkgSvcAtributeID]
,[BAGM_IsEditable]
,[BAGM_IsSystemPreConfigured]
,[BAGM_Code]
,[BAGM_CopiedFromCode]
,[BAGM_IsDeleted]
,[BAGM_CreatedBy]
,[BAGM_CreatedOn]
,[BAGM_ModifiedBy]
,[BAGM_ModifiedOn]
,[BAGM_IsDisplay]
,[BAGM_DisplaySequence]
,[BAGM_IsRequired]
INTO #tmpBkgAttributeGroupMapping_AllEntries
FROM #tmpBkgAttrGrpAndBkgSvcAttrGrpMapping AS tmpBAGBSG
WHERE tmpBAGBSG.BAGM_ID IS NOT NULL
--For BkgSvcAttributeGroupMapping
SELECT DISTINCT [BSAGM_ID]
,[BSAGM_ServiceId]
,[BSAGM_AttributeGroupMappingID]
,[BSAGM_IsEditable]
,[BSAGM_IsSystemPreConfigured]
,[BSAGM_IsDeleted]
,[BSAGM_CreatedBy]
,[BSAGM_CreatedOn]
,[BSAGM_ModifiedBy]
,[BSAGM_ModifiedOn]
,[BSAGM_Code]
,[BSAGM_CopiedFromCode]
INTO #tmpBkgSvcAttributeGroupMapping
FROM #tmpBkgAttrGrpAndBkgSvcAttrGrpMapping AS tmpBAGBSG
WHERE tmpBAGBSG.BSAGM_ID IS NOT NULL
AND tmpBAGBSG.BSAGM_ID NOT IN (
SELECT CBSAGM.BSAGM_ID
FROM ams.BkgSvcAttributeGroupMapping CBSAGM
)
--For BkgSvcAttributeGroupMapping-AllEntries
SELECT DISTINCT [BSAGM_ID]
,[BSAGM_ServiceId]
,[BSAGM_AttributeGroupMappingID]
,[BSAGM_IsEditable]
,[BSAGM_IsSystemPreConfigured]
,[BSAGM_IsDeleted]
,[BSAGM_CreatedBy]
,[BSAGM_CreatedOn]
,[BSAGM_ModifiedBy]
,[BSAGM_ModifiedOn]
,[BSAGM_Code]
,[BSAGM_CopiedFromCode]
INTO #tmpBkgSvcAttributeGroupMapping_AllEntries
FROM #tmpBkgAttrGrpAndBkgSvcAttrGrpMapping AS tmpBAGBSG
WHERE tmpBAGBSG.BSAGM_ID IS NOT NULL
BEGIN TRANSACTION
-- Inserting Data
-- 1. Insert Data into Tenant Attribute from Security Attribute
IF EXISTS (
SELECT 1
FROM #tmpBkgSvcAttributes
)
BEGIN
INSERT INTO [AMS].[BkgSvcAttribute] (
[BSA_ID]
,[BSA_Name]
,[BSA_Description]
,[BSA_Label]
,[BSA_DataTypeID]
,[BSA_IsRequired]
,[BSA_ReqValidationMessage]
,[BSA_MaxIntValue]
,[BSA_MinIntValue]
,[BSA_MaxDateValue]
,[BSA_MinDateValue]
,[BSA_MaxLength]
,[BSA_MinLength]
,[BSA_IsEditable]
,[BSA_IsSystemPreConfiguredq]
,[BSA_Code]
,[BSA_CopiedFromCode]
,[BSA_IsDeleted]
,[BSA_CreatedById]
,[BSA_CreatedDate]
,[BSA_ModifiedBy]
,[BSA_ModifiedDate]
,[BSA_Active]
)
SELECT [BSA_ID]
,[BSA_Name]
,[BSA_Description]
,[BSA_Label]
,[BSA_DataTypeID]
,[BSA_IsRequired]
,[BSA_ReqValidationMessage]
,[BSA_MaxIntValue]
,[BSA_MinIntValue]
,[BSA_MaxDateValue]
,[BSA_MinDateValue]
,[BSA_MaxLength]
,[BSA_MinLength]
,[BSA_IsEditable]
,[BSA_IsSystemPreConfiguredq]
,[BSA_Code]
,[BSA_CopiedFromCode]
,[BSA_IsDeleted]
,[BSA_CreatedById]
,GETUTCDATE() --[BSA_CreatedDate]
,[BSA_ModifiedBy]
,[BSA_ModifiedDate]
,[BSA_Active]
FROM #tmpBkgSvcAttributes
WHERE #tmpBkgSvcAttributes.BSA_ID NOT IN (
SELECT CBSA.BSA_ID
FROM ams.BkgSvcAttribute CBSA
)
END
-- 2. Insert Data into Tenant AttributeGroup from Security Attribute Group
IF EXISTS (
SELECT 1
FROM #tmpBkgSvcAttributesGroup
)
BEGIN
INSERT INTO [AMS].[BkgSvcAttributeGroup] (
[BSAD_ID]
,[BSAD_Name]
,[BSAD_Description]
,[BSAD_IsEditable]
,[BSAD_IsSystemPreConfigured]
,[BSAD_Code]
,[BSAD_CopiedFromCode]
,[BSAD_IsDeleted]
,[BSAD_CreatedById]
,[BSAD_CreatedDate]
,[BSAD_ModifiedBy]
,[BSAD_ModifiedDate]
)
--,[BSAD_IsRequired]
SELECT [BSAD_ID]
,[BSAD_Name]
,[BSAD_Description]
,[BSAD_IsEditable]
,[BSAD_IsSystemPreConfigured]
,[BSAD_Code]
,[BSAD_CopiedFromCode]
,[BSAD_IsDeleted]
,[BSAD_CreatedById]
,GETUTCDATE() --[BSAD_CreatedDate]
,[BSAD_ModifiedBy]
,[BSAD_ModifiedDate]
--,[BSAD_IsRequired]
FROM #tmpBkgSvcAttributesGroup
WHERE #tmpBkgSvcAttributesGroup.BSAD_ID NOT IN (
SELECT CBSAD.BSAD_ID
FROM ams.BkgSvcAttributeGroup CBSAD
)
END
-- 3. Insert Data into Tenant BackgroundService from Security BackgroundServices
IF EXISTS (
SELECT 1
FROM #tmpBackgroundServices
)
BEGIN
INSERT INTO [AMS].[BackgroundService] (
[BSE_ID]
,[BSE_Name]
,[BSE_Description]
,[BSE_SvcTypeID]
,[BSE_IsEditable]
,[BSE_IsSystemPreConfigured]
,[BSE_IsDeleted]
,[BSE_CreatedById]
,[BSE_CreatedDate]
,[BSE_ModifiedBy]
,[BSE_ModifiedDate]
,[BSE_ClientCount]
,[BSE_ParentServiceID]
)
SELECT [BSE_ID]
,[BSE_Name]
,[BSE_Description]
,[BSE_SvcTypeID]
,[BSE_IsEditable]
,[BSE_IsSystemPreConfigured]
,[BSE_IsDeleted]
,[BSE_CreatedById]
,GETUTCDATE() --[BSE_CreatedDate]
,[BSE_ModifiedBy]
,[BSE_ModifiedDate]
,NULL
,[BSE_ParentServiceID]
FROM #tmpBackgroundServices
END
-- 4. Insert Data into Tenant [BkgAttributeGroupMapping] from Security [BkgAttributeGroupMapping]
IF EXISTS (
SELECT 1
FROM #tmpBkgAttributeGroupMapping
)
BEGIN
INSERT INTO [AMS].[BkgAttributeGroupMapping] (
[BAGM_ID]
,[BAGM_BkgSvcAttributeGroupId]
,[BAGM_BkgSvcAtributeID]
,[BAGM_IsEditable]
,[BAGM_IsSystemPreConfigured]
,[BAGM_Code]
,[BAGM_CopiedFromCode]
,[BAGM_IsDeleted]
,[BAGM_CreatedBy]
,[BAGM_CreatedOn]
,[BAGM_ModifiedBy]
,[BAGM_ModifiedOn]
,[BAGM_IsDisplay]
,[BAGM_DisplaySequence]
,[BAGM_IsRequired]
)
SELECT [BAGM_ID]
,[BAGM_BkgSvcAttributeGroupId]
,[BAGM_BkgSvcAtributeID]
,[BAGM_IsEditable]
,[BAGM_IsSystemPreConfigured]
,[BAGM_Code]
,[BAGM_CopiedFromCode]
,[BAGM_IsDeleted]
,[BAGM_CreatedBy]
,GETUTCDATE() --[BAGM_CreatedOn]
,[BAGM_ModifiedBy]
,[BAGM_ModifiedOn]
,[BAGM_IsDisplay]
,[BAGM_DisplaySequence]
,[BAGM_IsRequired]
FROM #tmpBkgAttributeGroupMapping
END
-- 5. Insert Data into Tenant [BkgSvcAttributeGroupMapping] from Security BkgSvcAttributeGroupMapping
IF EXISTS (
SELECT 1
FROM #tmpBkgSvcAttributeGroupMapping
)
BEGIN
INSERT INTO [AMS].[BkgSvcAttributeGroupMapping] (
[BSAGM_ID]
,[BSAGM_ServiceId]
,[BSAGM_AttributeGroupMappingID]
,[BSAGM_IsEditable]
,[BSAGM_IsSystemPreConfigured]
,[BSAGM_IsDeleted]
,[BSAGM_CreatedBy]
,[BSAGM_CreatedOn]
,[BSAGM_ModifiedBy]
,[BSAGM_ModifiedOn]
,[BSAGM_Code]
,[BSAGM_CopiedFromCode]
)
SELECT [BSAGM_ID]
,[BSAGM_ServiceId]
,[BSAGM_AttributeGroupMappingID]
,[BSAGM_IsEditable]
,[BSAGM_IsSystemPreConfigured]
,[BSAGM_IsDeleted]
,[BSAGM_CreatedBy]
,GETUTCDATE() --[BSAGM_CreatedOn]
,[BSAGM_ModifiedBy]
,[BSAGM_ModifiedOn]
,[BSAGM_Code]
,[BSAGM_CopiedFromCode]
FROM #tmpBkgSvcAttributeGroupMapping
END
-- 6. Insert Data into Tenant [BkgSvcAttributeOption] from Security BkgSvcAttributeOption
IF EXISTS (
SELECT 1
FROM #tmpBkgSvcAttributeOption
)
BEGIN
INSERT INTO [AMS].[BkgSvcAttributeOption] (
[EBSAO_ID]
,[EBSAO_BkgSvcAttributeID]
,[EBSAO_OptionText]
,[EBSAO_OptionValue]
,[EBSAO_IsDeleted]
,[EBSAO_IsActive]
,[EBSAO_CreatedByID]
,[EBSAO_CreatedOn]
,[EBSAO_ModifiedByID]
,[EBSAO_ModifiedOn]
)
SELECT [EBSAO_ID]
,[EBSAO_BkgSvcAttributeID]
,[EBSAO_OptionText]
,[EBSAO_OptionValue]
,[EBSAO_IsDeleted]
,[EBSAO_IsActive]
,[EBSAO_CreatedByID]
,GETUTCDATE() --[EBSAO_CreatedOn]
,[EBSAO_ModifiedByID]
,[EBSAO_ModifiedOn]
FROM #tmpBkgSvcAttributeOption
WHERE #tmpBkgSvcAttributeOption.EBSAO_ID NOT IN (
SELECT CBSAO.EBSAO_ID
FROM ams.BkgSvcAttributeOption CBSAO
)
END
--for storing the Mappings for BkgAttributeGroupMapping and BkgSvcAttributeGroupMapping based on Service ID
SELECT *
INTO #tmpClientAttrGrpAndSvcAttrGrpMapping
FROM [AMS].[BackgroundService] AS BS
INNER JOIN [AMS].[BkgSvcAttributeGroupMapping] AS BPAGP ON BS.BSE_ID = BPAGP.BSAGM_ServiceId
AND BPAGP.BSAGM_IsDeleted = 0
INNER JOIN [AMS].[BkgAttributeGroupMapping] AS BSAGM ON BSAGM.BAGM_ID = BPAGP.BSAGM_AttributeGroupMappingID
AND BSAGM.BAGM_IsDeleted = 0
INNER JOIN #ServiceID AS SI ON BS.[BSE_ID] = SI.Item
WHERE BS.BSE_IsDeleted = 0
-- for BkgAttributeGroupMapping
SELECT DISTINCT [BAGM_ID]
,[BAGM_BkgSvcAttributeGroupId]
,[BAGM_BkgSvcAtributeID]
,[BAGM_IsEditable]
,[BAGM_IsSystemPreConfigured]
,[BAGM_Code]
,[BAGM_CopiedFromCode]
,[BAGM_IsDeleted]
,[BAGM_CreatedBy]
,[BAGM_CreatedOn]
,[BAGM_ModifiedBy]
,[BAGM_ModifiedOn]
,[BAGM_IsDisplay]
,[BAGM_DisplaySequence]
,[BAGM_IsRequired]
INTO #tmpClientBkgAttributeGroupMap
FROM #tmpClientAttrGrpAndSvcAttrGrpMapping
SELECT *
INTO #tempUnmatchedBkgAttributeGroupMap
FROM #tmpClientBkgAttributeGroupMap T2
WHERE NOT EXISTS (
SELECT *
FROM #tmpBkgAttributeGroupMapping_AllEntries T1
WHERE T1.BAGM_ID = T2.BAGM_ID
)
-- for BkgSvcAttributeGroupMapping
SELECT DISTINCT [BSAGM_ID]
,[BSAGM_ServiceId]
,[BSAGM_AttributeGroupMappingID]
,[BSAGM_IsEditable]
,[BSAGM_IsSystemPreConfigured]
,[BSAGM_IsDeleted]
,[BSAGM_CreatedBy]
,[BSAGM_CreatedOn]
,[BSAGM_ModifiedBy]
,[BSAGM_ModifiedOn]
,[BSAGM_Code]
,[BSAGM_CopiedFromCode]
INTO #tmpClientBkgSvcAttributeGroupMap
FROM #tmpClientAttrGrpAndSvcAttrGrpMapping
SELECT *
INTO #tempUnmatchedBkgSvcAttributeGroupMap
FROM #tmpClientBkgSvcAttributeGroupMap T2
WHERE NOT EXISTS (
SELECT *
FROM #tmpBkgSvcAttributeGroupMapping_AllEntries T1
WHERE T1.BSAGM_ID = T2.BSAGM_ID
)
--do not delete
--UPDATE [AMS].[BkgAttributeGroupMapping]
--SET BAGM_IsDeleted = 1
-- ,BAGM_ModifiedOn = GETDATE()
--WHERE BAGM_ID IN (
-- SELECT BAGM_ID
-- FROM #tempUnmatchedBkgAttributeGroupMap
-- );
UPDATE BSAGM set BSAGM.BSAGM_IsDeleted=1,BSAGM.BSAGM_ModifiedOn=GETUTCDATE()
from [AMS].[BkgSvcAttributeGroupMapping] BSAGM
join #tempUnmatchedBkgSvcAttributeGroupMap temp on BSAGM.BSAGM_ID=temp.BSAGM_ID
COMMIT TRANSACTION
-- Drop Temp Tables
DROP TABLE #ServiceIDs
DROP TABLE #ServiceID
DROP TABLE #tmpBkgServicesWithChilds
DROP TABLE #tmpBkgSvcAttributeOption
DROP TABLE #tmpBkgAttrGrpAndBkgSvcAttrGrpMapping
DROP TABLE #tmpBkgSvcAttributesGroup
DROP TABLE #tmpBkgSvcAttributes
DROP TABLE #tmpBackgroundServices
DROP TABLE #tmpBkgAttributeGroupMapping
DROP TABLE #tmpBkgSvcAttributeGroupMapping
DROP TABLE #tmpBkgServices
DROP TABLE #tmpClientAttrGrpAndSvcAttrGrpMapping
DROP TABLE #tmpClientBkgAttributeGroupMap
DROP TABLE #tempUnmatchedBkgAttributeGroupMap
DROP TABLE #tmpClientBkgSvcAttributeGroupMap
DROP TABLE #tempUnmatchedBkgSvcAttributeGroupMap
DROP TABLE #tmpBkgAttributeGroupMapping_AllEntries
DROP TABLE #tmpBkgSvcAttributeGroupMapping_AllEntries
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
SET @Steps = @Steps + 1
EXEC usp_InsertServerProcessLog '[usp_CopyMasterServiceDataToClient]'
,@Steps
,'Starting usp_CopyMasterServiceDataToClient catch'
,@ProcessID
,'Error'
DECLARE @errorMessage VARCHAR(max)
DECLARE @errorSeverity INT;
DECLARE @errorState INT;
SELECT @errorSeverity = ERROR_SEVERITY();
SELECT @errorMessage = ERROR_MESSAGE();
SELECT @errorState = ERROR_STATE();
EXEC usp_InsertServerProcessLog usp_CopyMasterServiceDataToClient
,0
,@errorMessage
RAISERROR (
@errorMessage
,@errorSeverity
,@errorState
);
END CATCH
SET @Steps = @Steps + 1
EXEC usp_InsertServerProcessLog '[usp_CopyMasterServiceDataToClient]'
,@Steps
,'Ending Procedure usp_CopyMasterServiceDataToClient'
,@ProcessID
,'Info'
END
在我使用Ado .net的代码中调用该过程。
using (SqlConnection con = new SqlConnection(connection.StoreConnection.ConnectionString))
{
SqlCommand _command = new SqlCommand("ams.usp_CopyData", con);
_command.CommandType = CommandType.StoredProcedure;
_command.Parameters.AddWithValue("@ServiceIDs", SelectedServices.ToString());
con.Open();
Int32 rowsAffected = _command.ExecuteNonQuery();
if (rowsAffected > 0)
{
//some operation to perform
return true;
}
con.Close();
}