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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:52:11+00:00 2026-06-14T02:52:11+00:00

Below is my SP stored in MSSQL server. USE [testdb] GO /****** Object: StoredProcedure

  • 0

Below is my SP stored in MSSQL server.

USE [testdb]
GO
/****** Object:  StoredProcedure [dbo].[insertSerial]    Script Date: 11/05/2012 16:38:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[insertSerial]
AS

DECLARE @start int
DECLARE @end int
DECLARE @expdate datetime

BEGIN TRAN
WHILE @start < @end
BEGIN
 INSERT tbl_serial VALUES (@start, @expdate)
 SET @start = @start + 1
 END
 COMMIT TRAN    

and then I try to call the SP from my ASP.NET application like this –

        SqlConnection sqlconn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstr"].ConnectionString);
        SqlCommand cmd = new SqlCommand("insertSerial", sqlconn);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@start", txtStart.Text);
        cmd.Parameters.AddWithValue("@end", txtEnd.Text);
        cmd.Parameters.AddWithValue("@expdate", System.DateTime.Now);

        try
        {
            sqlconn.Open();
            cmd.ExecuteNonQuery();
        }
        catch (SqlException ex)
        {
            lblStatus.Text = ex.Message;
        }
        finally
        {
            sqlconn.Close();
        }

Then I got this Procedure insertSerial has no parameters and arguments were supplied. error. Is it because the way I declare parameters in SP is incorrect? If so, how do I fix them?

  • 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-14T02:52:12+00:00Added an answer on June 14, 2026 at 2:52 am

    The sp is invalid sql

    This is how to declare params

    ALTER PROCEDURE [dbo].[foo]
    @bar INT
    AS
    BEGIN

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

Sidebar

Related Questions

I want to use the script below to add pdf files stored as blob
I have data stored as below in an MS Access database: Date User 20090101
I have a stored procedure which when i call from MSSQL Server GUI.It returns
Does anybody know how to do this syntax below in mysql? Without Stored Procedure,
I have got the below stored procedure to return the list of Id, parentId
I am having the below statement from stored procedure. It's giving Insufficient Privileges. But
I am using the stored procedure below for the select command of a SqlDataSource,
I have a question about stored procedures in Oracle. Below is the stored procedure
I am trying to establish upper / lower bound in my stored procedure below
my stored procedure is like below, select T.TranNo,(Select Accountname from Accountable where AccountCode =T.tranAccountCode)

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.