1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Executing a select SP in visual studio???

Discussion in 'C#' started by Twice, Sep 1, 2008.

  1. Twice

    Twice New Member

    Joined:
    Feb 6, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    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)
     
    Last edited by a moderator: Sep 2, 2008

Share This Page