i created a stored procrdure that checks for duplicates in a database when importing data from a spreadsheet.When i try to execute the SP in visual studio using ExecuteNonQuiry() it throws that says executeNonQuiry does not execute select statements.
Is there any other way for me to execute this quiry.plz help.Here is the stored procedure
Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ChkDup]
@StudentID nvarchar(50),
@ModuleCode nvarchar(50)
AS
if exists(SELECT COUNT(StudentID),COUNT(ModuleCode)
FROM StudentID
Group By StudentID
HAVING COUNT(StudentID) < 1 AND COUNT(ModuleCode) < 1)
INSERT INTO StudentModule(StudentID,ModuleCode)
VALUES(@StudentID,@ModuleCode)