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) :
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