Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1061439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:28:25+00:00 2026-05-16T18:28:25+00:00

I am working on a Tag system for a news page designed in ASP.NET.

  • 0

I am working on a Tag system for a news page designed in ASP.NET. For the system I require a TagExists method to check for tags within the database. The stored procedure I have written is below.

ALTER PROCEDURE [dbo].[Tags_TagExists](
    @Tag varchar(50))
AS
BEGIN
    If (EXISTS(SELECT * FROM dbo.Tags WHERE LOWER(@Tag) = LOWER(Tag)))
        RETURN 1
    ELSE
        RETURN 0
END

When I call this method however 0 is always returned. I am using the following code to call the method

Public Shared Function TagExists(ByVal name As String) As Boolean
    Dim result As Boolean
    Using conn As SqlConnection = New SqlConnection(ConnectionString)
        Dim cmd As New SqlCommand("Tags_TagExists", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@Tag", name)
        conn.Open()
        result = Convert.ToBoolean(cmd.ExecuteScalar())
        conn.Close()
    End Using
    Return result
End Function

I have tried switching the procedure to return 0 if the tag exists and 1 if it does not and it still returns 0 despite the exact same testing conditions. I have also returned the actual select query and it has complained of the Tag “news” (my test item) not being an int on execution showing the select itself is definitely properly formed.

If anyone can shed some light on this, Thanks
Michael

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:28:25+00:00Added an answer on May 16, 2026 at 6:28 pm

    It should probably be a function, but here is the stored proc code:

    ALTER PROCEDURE [dbo].[Tags_TagExists](
        @Tag varchar(50))
    AS
    BEGIN
        If EXISTS(SELECT 1 FROM dbo.Tags WHERE LOWER(@Tag) = LOWER(Tag))
            BEGIN
                SELECT 1
            END    
        ELSE
            BEGIN
                SELECT 0
            END
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with a publishing system that uses custom tags. These are interpreted on
In a blog system I'm working on, I want to use tags as a
I'm working on an intranet system (.NET 3.5); the main pages are served up
I'm working with ASP.Net Membership with FormsAuth and have run into a strange problem.
So I'm working on a tags system, and I have a field that looks
I have a StackOverflow-like tagging system for a database I'm working on. And I'm
I have been working in ASP.NET Web Applications (not MVC) for a while at
I'm currently working on my news system on my webpage, and I've come to
I'm working on a news site and I'm thinking of implementing a tagging system
I'm working on a page which is dynamically generated via a CGI system, where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.