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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:23:53+00:00 2026-05-16T16:23:53+00:00

My function isn’t returning anything – strReturn is empty: try { SqlParameter[] parameter =

  • 0

My function isn’t returning anything – strReturn is empty:

        try
        {
            SqlParameter[] parameter = new SqlParameter[]
            {
                new SqlParameter("@MerchantID", MercahntID),
                new SqlParameter("@LoactionID", LoactionID)
            };

            SqlHelper.ExecuteNonQuery(DbConnString, System.Data.CommandType.StoredProcedure, "GetMerchantLocationZip", parameter);

            return strReturn;
        }
        catch (Exception ex)
        {
            LogError("Error Occurred When Retrieving Mercahnt Location Zip: MercahntID:" + MercahntID.ToString(), ex);
            return strReturn;
        }
    }

When I execute this stored proc using ‘exec GetMerchantLocationZip (3333, 373773)’ I get the correct zipcode in SQL. Why don’t I get it in Visual Studio?

Create PROCEDURE [dbo].[GetMerchantLocationZip](
@MerchantID bigint,
@LoactionID bigint)

AS 

Begin

Select Zip FROM Merchant_Location 
where MerchantID=@MerchantID AND LocationID =@LoactionID

End

I am learning, so apologies if it’s a obvious error. Thanks all!

  • 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-16T16:23:54+00:00Added an answer on May 16, 2026 at 4:23 pm

    You’re not getting results because you’re not executing the code as a Query.

    You’re calling SqlHelper.ExecuteNonQuery() which doesn’t return any results.

    It looks like you’re using the SqlHelper application block, so I think the code you want would be (if you’re returning multiple rows in the query):

    DataSet ds = SqlHelper.ExecuteDataSet(DbConnString,
                                          CommandType.StoredProcedure,
                                          "GetMerchantLocationZip",
                                          parameter);
    

    ds will then contain the results of the query.

    If you’re trying to retrieve a single value from the database rather than a set of rows, then your code would be:

    object zip = SqlHelper.ExecuteScalar(DbConnString,
                                         CommandType.StoredProcedure,
                                         "GetMerchantLocationZip",
                                         parameter);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written the following function but it's isn't returning anything when I run
Why isn't my code around the test function in Object RegExp working the same
I've been using the search function but I think there isn't any related question
This function is O(log(n)). Why? Isn't it looping up to n? function fxn($n) {
How does one use the CGRectIntegral function? I understand it's purpose. The documentation isn't
What, exactly, is the purpose of the intval() function for a base-10 calculation? Isn't
function Apple(){ this.name=apple; } function Orange(){ this.name=orange; this.apple = new Apple(); this.apple.onCalled=function(){ alert(this.name); }
In PHP I have seen that if a certain process or function isn't completed
The mail($to, $subject, $message, $from); function isn't working in the code below. <!DOCTYPE html
In safari 4 and all explorer browsers, whenever I try to call a function

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.