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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:08:54+00:00 2026-05-16T12:08:54+00:00

I have a problem executing a stored procedure in Silverlight 4/RIA. The only value

  • 0

I have a problem executing a stored procedure in Silverlight 4/RIA. The only value I get back is null. Am I doing my client and server side code wrong?

Client Side :

public ZipCodesDomainContext _ZipcodesDomainContext = new ZipCodesDomainContext();

        /// <summary>
        /// Creates a new <see cref="MainPage"/> instance.
        /// </summary>
        public MainPage()
        {
            InitializeComponent();
            this.loginContainer.Child = new LoginStatus();
            LoadCity();
        }
private void LoadCity()
        {
            txtCity.Text = _ZipcodesDomainContext.GetCityByZip(42071).Value;
        }

Domain Service :

public string GetCityByZip(int pZip)
        {
            return ObjectContext.sp_GetCityByZip(pZip).ToString();
        }

Data Model (When selecting the stored proc) :
alt text

Stored Procedure :

USE [ZIPCODES]
GO
/****** Object:  StoredProcedure [dbo].[sp_GetCityByZip]    Script Date: 08/23/2010 13:48:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[sp_GetCityByZip] 
    @ZIP int

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    SELECT City FROM ZipCodes WHERE Zip = @ZIP
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-05-16T12:08:55+00:00Added an answer on May 16, 2026 at 12:08 pm

    What do you mean you are getting null back?

    Firstly, your function GetCityByZip returns a string which you are doing a .Value on which isn’t valid.

    If your getting null back from the stored proc:

    return ObjectContext.sp_GetCityByZip(pZip).ToString();
    

    would fail because you would be trying to do a ToString() on a null object.

    What is ObjectContext? Are you using Linq To SQL? If so you get back result set which should have a wrapper of all the data so you would do something like:

    ObjectContext.sp_GetCityByZip(pZip).City;
    

    And then your other call would just be:

    txtCity.Text = _ZipcodesDomainContext.GetCityByZip(42071);
    

    If you clear it up a bit I might be able to figure out what the exact issue is but in it’s current state your question has me confused.

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

Sidebar

Related Questions

I have problem executing below stored procedure. I am getting error of ORA-00932: inconsistent
The problem is I have a stored procedure that runs consistently in Sql Server
I have a problem executing a process from our testing server. On my localhost
I have executing 10 query in my stored procedure. In case after executing the
I have a data access layer which returns DataSets/DataTables by executing Stored Procedure. Everything
I am executing a stored procedure on a SQL server using a SqlCommand class
I have a stored procedure in SQL Server 2008 that will insert a record
I am having difficulty executing a MS SQL Server stored procedure from Java/jsp. I
I'm working with sql server 2008r2 developer. I have a stored procedure that adds
I have a problem where it seems that when running the same stored procedure

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.