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 8508271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:06:58+00:00 2026-06-11T03:06:58+00:00

How can be call a SQL function which takes two parameters? I want memorize

  • 0

How can be call a SQL function which takes two parameters? I want memorize the returning value in a variable.

The function is:

CREATE  FUNCTION [CheckPwd](  @User nvarchar(50),  @Pwd nvarchar(50)) 
RETURNS int
AS
BEGIN
DECLARE @RES int
DECLARE @PWD_DB varbinary(255)

  IF (@User is not null and @User != '' and @Pwd is not null and @Pwd != '' )
begin
    SELECT  @PWD_DB = password FROM UserTable WHERE username = @User
        SET @PwdRES = pwdcompare(@Pwd, @PWD_DB )
end
  ELSE
        SET @PwdRES = 0

RETURN @RES
END
  • 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-06-11T03:07:00+00:00Added an answer on June 11, 2026 at 3:07 am

    Here’s an example with a stored-procedure, with plain SQL it’s similar.

    Public Function getFooID(param1 As Int32, param2 As String)As Int32
        Dim returnValue As Int32
        Using con = New SqlConnection(My.Settings.ConnectionString)
            Using cmd = New SqlCommand("dbo.Foo", con)
                cmd.CommandType = System.Data.CommandType.StoredProcedure
                cmd.Parameters.AddWithValue("@param1", param1)
                cmd.Parameters.AddWithValue("@param2", param2)
                 Try
                    con.Open()
                    returnValue = DirectCast(cmd.ExecuteScalar(), Int32)
                Catch ex As Exception
                    ' a good place to insert logging functionality '
                    log.Error("Error in getFooId: " + ex.Message);
                    ' note that Throw keeps the stacktrace unlike Throw ex '
                    Throw
                End Try
            End Using
        End Using
        Return returnValue 
    End Sub
    

    SqlCommand.ExecuteScalar Method

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that I can call ToString().IndexOf(...), but I don't want to create an
1.) I can create a simple application which has one routine called function ConnectToDB:
How can I create an Oracle stored procedure which accepts a variable number of
BACKGROUND I'm trying to write a function query query('type', 'parameters', 'bind_types') which I can
I need to call some PL/SQL procedures from my Java application. I can do
In Ruby I can call methods with array elements used as positional parameters like
Using a delegate I can call any function asynchronously. From the documentation I understand
I'm trying to create a generic LINQ-TO-SQL repository based on this post which basically
I am using Linq to SQL to call a stored procedure which runs a
I have an org.springframework.jdbc.object.StoredProcedure which I am using to call a DB function. I

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.