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

  • Home
  • SEARCH
  • 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 6056497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:22:57+00:00 2026-05-23T08:22:57+00:00

I wrote a SQL Server stored procedure based on my previous question that I

  • 0

I wrote a SQL Server stored procedure based on my previous question that I asked which was answered that is why I am creating a new question.

STORED PROCEDURE

ALTER Procedure [dbo].[usp_validatecard](
@CLUBCARD1 nvarchar(50),
@STATUS nvarchar(50))
As

BEGIN
IF EXISTS(Select CLUBCARD1, STATUS
from dbo.clubmembers 
where CLUBCARD1 = @CLUBCARD1 and STATUS = 'ACTIVE')
Print 'Card is GOOD'
ELSE
IF EXISTS(SELECT CLUBCARD1, STATUS
FROM dbo.clubmembers
where CLUBCARD1 = @CLUBCARD1 and STATUS = 'INACTIVE')
PRINT 'Card is good but not active'
ELSE
PRINT 'CARD NOT IN SYSTEM'
END

The trouble I am having is not too sure how to call that in VB. The code I have so far is this

Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.Data

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub cmdclick_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdclick.Click
        Dim strConnString As String = WebConfigurationManager.ConnectionStrings("orca").ConnectionString
        Dim con As New SqlConnection(strConnString)
        Dim cmd As New SqlCommand("usp_validatecard", con)
        cmd.CommandType = Data.CommandType.StoredProcedure

        cmd.Parameters.Add("@CLUBCARD1", Data.SqlDbType.NVarChar).Value = txtvalidate.Text

        Try
            con.Open()
            Dim Result As Integer = cmd.ExecuteNonQuery()
        Catch ex As SqlException
            lblmessage.Text = "Error"
        Finally
            con.Close()
        End Try
    End Sub
End Class

What I am trying to do is if the clubcard parameter is found and status is active I would like the label to read ‘card is good’ also if the clubcard parameter is found however is inactive then the label should read ‘card is good but not active’ last if all those fail just have the label read ‘card not in system’

As of right now this code does not work I thought I could just call the stored procedure and exec it and it would print the statements depending on what passes however it is erroring out.

When I debug it the error I get is under the cmd.parameters.add is

Item In order to evaluate an indexed
property, the property must be
qualified and the arguments must be
explicitly supplied by the user.

  • 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-23T08:22:57+00:00Added an answer on May 23, 2026 at 8:22 am

    You can change your SP to

    BEGIN
    IF EXISTS(Select CLUBCARD1, STATUS
    from dbo.clubmembers 
    where CLUBCARD1 = @CLUBCARD1 and STATUS = 'ACTIVE')
    Print 'Card is GOOD'
    Select 'Card is GOOD'; 
    ELSE
    IF EXISTS(SELECT CLUBCARD1, STATUS
    FROM dbo.clubmembers
    where CLUBCARD1 = @CLUBCARD1 and STATUS = 'INACTIVE')
    PRINT 'Card is good but not active'
    Select 'Card is good but not active'; 
    ELSE
    PRINT 'CARD NOT IN SYSTEM'
    Select 'CARD NOT IN SYSTEM'; 
    END
    

    and in vb.net side,

    Dim reader as SqlDataReader = command.ExecuteReader()
    If reader.Read() Then
        lblmessage.Text = Convert.ToString(reader(0))
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to write SQL Server Stored Procedure which to be strongly
I'm try to figure how to create sql server stored procedure that when a
I'm trying to use a SQL Server stored procedure with ASP: ALTER PROCEDURE [dbo].[user_insert]
I want to write a SQL Server 2005 stored procedure which will select and
Here's my SQL Server stored procedure : ALTER PROCEDURE [dbo].[SearchUser] (@Text NVARCHAR(100), @TotalRows INT
I have a stored procedure in SQL Server 2005 which accepts few parameters of
I need to write a Stored procedure in SQL server whose data returned will
I'm need to write a stored procedure for SQL Server 2008 for performing a
I'm trying to write this as part of stored procedure on SQL Server 2000.
I am using a Microsoft SQL Server 2005 stored procedure to post records in

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.