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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:06:16+00:00 2026-05-16T20:06:16+00:00

I have created a stored procedure shown below ,how will i call this from

  • 0

I have created a stored procedure shown below ,how will i call this from c# code behind to get the result and results are stored in dataset.

USE [Test]
GO
/****** Object:  StoredProcedure [dbo].[tesproc]    Script Date: 09/01/2010 13:00:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
 ALTER PROCEDURE [dbo].[tesproc]
    -- Add the parameters for the stored procedure here
    @a float, @b float, @c float,@d 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 Id, Name1,ZipCode,StreetName,StreetNumber,State1,Lat,Lng,  ( 6371 * ACOS( COS( (@a/@b) ) * COS(  (Lat/@b)  ) * COS( ( Lng/@b ) - (@c/@b) )  + SIN( @a/@b ) * SIN(  Lat/@b  ) ) ) as distance from business_details where ( 6371 * ACOS( COS( (@a/@b) ) * COS(  (Lat/@b)  ) * COS( ( Lng/@b ) - (@c/@b) )  + SIN( @a/@b ) * SIN(  Lat/@b  ) ) )<@d
END

If i execute this stored procedure in sql server its working fine with this following call

exec dbo.tesproc 12.9216667 ,57.2958,77.591667,1
  • 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-16T20:06:17+00:00Added an answer on May 16, 2026 at 8:06 pm
    using (SqlConnection conn = new SqlConnection("connection string goes here"))
    using (SqlCommand comm = new SqlCommand("tesproc", conn))
    {
        comm.CommandType = CommandType.StoredProcedure;
        comm.Parameters.AddWithValue("@a", 0.1);
        // etc
    
        conn.Open();
    
        using (SqlDataReader reader = comm.ExecuteReader())
        {
            while (reader.Read())
            {
                int id = reader.GetInt32(reader.GetOrdinal("id"));
                // etc
            }
        }
    }
    

    There are lots of comprehensive samples on the internet:

    http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson04.aspx

    My code sample is just demonstrating what it might look like – it was written straight in the editor so may not work on its own.

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

Sidebar

Related Questions

I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5) ,
I have written a Stored Procedure as shown , which will be responsible to
I have a Stored Procedure in MSSQL 2008, inside of this i've created a
I have the MYSQL stored procedure defined as shown below: DROP PROCEDURE IF EXISTS
I have just created a report in Report Manager using a Stored Procedure which
I have a dynamic SQL statement I've created in a stored procedure. I need
I have this stored procedure: CREATE OR REPLACE PROCEDURE LIQUIDACION_OBTENER ( p_Cuenta IN NUMBER,
I have the fallowing stored procedure: CREATE PROCEDURE `get`(IN tb VARCHAR(50), IN id INTEGER)
I have created a stored procedure CREATE PROCEDURE GetCustomerWiseSales(@StartDate nvarchar(10), @EndDate nvarchar(10)) AS SELECT
I need to create a stored procedure which will get destination IP and then

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.