SQL Server :: Procedure Or Function Has Too Many Arguments Specified When Execute

Sep 27, 2010

When i execute this SP in DB, it works fine. But when i execute from asp.net app it is throwing error: Procedure or function ... has too many arguments specified

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROC [dbo].[sp_Customer]
@brchID char(40),
@brchName VARCHAR(50),
@userID VARCHAR(50)
AS
BEGIN
TRANSACTION
DECLARE @req_pk int
DECLARE @customer_org_pk int
IF EXISTS(SELECT * FROM [customer] WHERE [org_id] like @brchID)
BEGIN
SELECT [org_pk] FROM [customer] WHERE [org_id] like @brchID
END
ELSE
BEGIN
EXEC sp_get_next_control_no 'organization.org_pk',@customer_org_pk out;
INSERT INTO [customer] (org_pk,[org_id],[org_name])
VALUES(@customer_org_pk,@brchID,@brchName)
SELECT [org_pk] FROM [customer] WHERE [org_id] like @brchID
END
--Address Book Entry
IF NOT EXISTS(SELECT * FROM [address_book] WHERE [prsn_id] like @userID)
BEGIN
exec sp_get_next_control_no 'person.prsn_pk',@req_pk out;
END
IF (@@ERROR <> 0)
BEGIN
-- Rollback the transaction
ROLLBACK
RETURN
END
ELSE
BEGIN
COMMIT
END

Here is my asp method:

public static string Customer(string brchId, string brchName, string userId)
{
string spName = "st_Customer";
SqlParameter OrgPk = new SqlParameter("@org_pk", SqlDbType.Int);
OrgPk.Direction = ParameterDirection.Output;
OrgPk.Size = 50;
try
{
SqlHelper.ExecuteNonQuery(Config.ConnectionString,
CommandType.StoredProcedure, spName,
new SqlParameter("@brchID", brchId),
new SqlParameter("@brchName", brchName),
new SqlParameter("@userID", userId),
OrgPk
);
return Convert.ToString(OrgPk.Value);
}
}

View 4 Replies


Similar Messages:

SQL Server :: Procedure Or Function Sp_deleteprocedure Has Too Many Arguments Specified

Nov 15, 2010

I am facing this annoying message on delete ...here is my aspx..whats the solution?

[Code]....

and here is my code behind from where i am calling my stored procedure for deletion.

[Code]....

View 8 Replies

SQL Server :: An Insufficient Number Of Arguments Were Supplied For The Procedure Of Function

Feb 1, 2011

I am maintaining a sql proc someone else wrote long ago. Basically I have a stored procedure which calls a function. If I try to run the stored procedure, or to make changes to it, and then run it, I am getting an error message which says "An insufficient number of arguments were supplied for the procedure of function dbo.GetRecentComment

This is very odd, because the stored procedure runs successfully when called via the C# code. Yet if it is run within query analyzer with the correct parameters, I get that error message. Here is a little peice of the stored proc which calls the function. And below that is the function which is being called. It appears that the second parameter passed to the function is optional, yet I am not sure. Anyway, here is some of the code from the proc, which calls the function.

SELECT CompletionDate, dbo.GetRecentComment(Request.RequestId) AS Comments -- This line is where the function is called FROM Request

Here is the function which is being called

ALTER FUNCTION [dbo].[GetRecentComment]
(
@RequestId int,
@SmallTag bit -- smalltag appears to be optional.
)
RETURNS VARCHAR(500)
AS
BEGIN

View 4 Replies

Web Forms :: Procedure Or Function Emp_info Has Too Many Arguments Specified

Nov 4, 2010

i am getting problem "procedure or function emp_info has toomany arguments specified" while inserting data into two tables using stored procedure.I specified same number of parameters in stored procedure as specified in the apllication.

string creationdt = TextBox5.Text + "/" + DropDownList1.SelectedValue + "/" + TextBox6.Text;// Convert.ToDateTime());
string join_dt = TextBox7.Text + "/" + DropDownList16.SelectedValue + "/" + TextBox8.Text;
string modify_dt = TextBox11.Text + "/" + DropDownList17.SelectedValue + "/" + TextBox12.Text;
string exitdt = TextBox9.Text + "/" + DropDownList18.SelectedValue + "/" + TextBox10.Text;
string birth_dt = TextBox19.Text + "/" + DropDownList19.SelectedValue + "/" + TextBox20.Text;
c.con.Open();
sqt = c.con.BeginTransaction();
c.cmd.Transaction = sqt;
c.cmd.CommandText = "logininfo";
c.cmd.CommandType = CommandType.StoredProcedure;
c.cmd.Parameters.Add("@loginid", SqlDbType.VarChar).Value = TextBox21.Text;
c.cmd.Parameters.Add("@password", SqlDbType.VarChar).Value = TextBox22.Text;
c.cmd.Parameters.Add("@status", SqlDbType.VarChar).Value = DropDownList3.SelectedValue;
c.cmd.Parameters.Add("@secque", SqlDbType.VarChar).Value = DropDownList15.SelectedValue;
c.cmd.Parameters.Add("@secans", SqlDbType.VarChar).Value = TextBox26.Text;
c.cmd.Parameters.Add("@emp_role", SqlDbType.VarChar).Value = DropDownList2.SelectedValue;
c.cmd.Parameters.Add("@type", SqlDbType.VarChar).Value = DropDownList14.SelectedValue;
c.cmd.ExecuteNonQuery();
c.cmd.CommandText = "emp_info";
c.cmd.CommandType = CommandType.StoredProcedure;
c.cmd.Parameters.Add("@deptname", SqlDbType.VarChar).Value = TextBox1.Text;
c.cmd.Parameters.Add("@creation_dt", SqlDbType.VarChar).Value = creationdt;
c.cmd.Parameters.Add("@fname", SqlDbType.VarChar).Value = TextBox3.Text;
c.cmd.Parameters.Add("@midname", SqlDbType.VarChar).Value = TextBox4.Text;
c.cmd.Parameters.Add("@lname", SqlDbType.VarChar).Value = TextBox23.Text;
c.cmd.Parameters.Add("@designation", SqlDbType.VarChar).Value = DropDownList18.SelectedValue;
c.cmd.Parameters.Add("@rep_mngr", SqlDbType.Int).Value = DropDownList3.SelectedValue;
c.cmd.Parameters.Add("@joindt", SqlDbType.VarChar).Value = join_dt;
c.cmd.Parameters.Add("@exit_dt", SqlDbType.VarChar).Value = exitdt;
//c.cmd.Parameters.Add("@last_update", SqlDbType.VarChar).Value = TextBox24.Text;
//c.cmd.Parameters.Add("@update_by", SqlDbType.VarChar).Value = TextBox25.Text;
c.cmd.Parameters.Add("@modifydt", SqlDbType.VarChar).Value = modify_dt;
c.cmd.Parameters.Add("@emailid", SqlDbType.VarChar).Value = TextBox13.Text;
c.cmd.Parameters.Add("@altemailid", SqlDbType.VarChar).Value = TextBox14.Text;
c.cmd.Parameters.Add("@pancardno", SqlDbType.VarChar).Value = TextBox17.Text;
c.cmd.Parameters.Add("@passportno", SqlDbType.VarChar).Value = TextBox18.Text;
c.cmd.Parameters.Add("@licenseno", SqlDbType.VarChar).Value = TextBox15.Text;
c.cmd.Parameters.Add("@gender", SqlDbType.VarChar).Value = DropDownList7.SelectedValue;
c.cmd.Parameters.Add("@maritialstatus", SqlDbType.VarChar).Value = DropDownList9.SelectedValue;
c.cmd.Parameters.Add("@contact_no", SqlDbType.Int).Value = TextBox16.Text;
c.cmd.Parameters.Add("@DOB", SqlDbType.VarChar).Value = birth_dt;
c.cmd.Parameters.Add("@per_adds1", SqlDbType.VarChar).Value = TextBox27.Text;
c.cmd.Parameters.Add("@per_adds2", SqlDbType.VarChar).Value = TextBox28.Text;
c.cmd.Parameters.Add("@per_state", SqlDbType.VarChar).Value = TextBox33.Text;
c.cmd.Parameters.Add("@per_city", SqlDbType.VarChar).Value = TextBox34.Text;
c.cmd.Parameters.Add("@cur_adds1", SqlDbType.VarChar).Value = TextBox31.Text;
c.cmd.Parameters.Add("@cur_adds2", SqlDbType.VarChar).Value = TextBox32.Text;
c.cmd.Parameters.Add("@cur_state", SqlDbType.VarChar).Value = TextBox29.Text;
c.cmd.Parameters.Add("@cur_city", SqlDbType.VarChar).Value = TextBox30.Text;
//c.cmd.Parameters.Add("@photo", SqlDbType.Image).Value = FileUpload1.PostedFile.FileName;
int Emp_Id = (int)c.cmd.ExecuteScalar();
//c.cmd.ExecuteNonQuery();
sqt.Commit();

View 5 Replies

ADO.NET :: Error - Procedure Or Function InsCSSampleDet Has Too Many Arguments Specified

Nov 10, 2010

I have a gridview that has a column of checkboxes in which you use to select a row of data. Once you select a checkbox or multiple checkboxes and click the 'process' button the data from the rows selected should enter a table in a database. It works fine when i check just one checkbox, but when i check more than one i get the following error: 'Procedure or function insCSSampleDet has too many arguments specified.' Below is a copy of my loop

For Each gvrow As GridViewRow In GridView2.Rows
Dim CheckBox1 As CheckBox = DirectCast(gvrow.FindControl("CheckBox1"), CheckBox)
If CheckBox1.Checked Then
SamplesDataSource2.InsertCommandType = SqlDataSourceCommandType.StoredProcedure
SamplesDataSource2.InsertCommand = "insCSSampleDet"
SamplesDataSource2.InsertParameters.Add("CSHdrRowid", "1")
SamplesDataSource2.InsertParameters.Add("CSPartno", DirectCast(gvrow.FindControl("Label2"), Label).Text)
SamplesDataSource2.InsertParameters.Add("CSPartDesc", DirectCast(gvrow.FindControl("Label3"), Label).Text)
SamplesDataSource2.InsertParameters.Add("CSQty", DbType.Int32, "1")
SamplesDataSource2.Insert()
End If
NextFor Each gvrow As GridViewRow In GridView2.Rows
Dim CheckBox1 As CheckBox = DirectCast(gvrow.FindControl("CheckBox1"), CheckBox)
If CheckBox1.Checked Then
SamplesDataSource2.InsertCommandType = SqlDataSourceCommandType.StoredProcedure
SamplesDataSource2.InsertCommand = "insCSSampleDet"
SamplesDataSource2.InsertParameters.Add("CSHdrRowid", "1")
SamplesDataSource2.InsertParameters.Add("CSPartno", DirectCast(gvrow.FindControl("Label2"), Label).Text)
SamplesDataSource2.InsertParameters.Add("CSPartDesc", DirectCast(gvrow.FindControl("Label3"), Label).Text)
SamplesDataSource2.InsertParameters.Add("CSQty", DbType.Int32, "1")
SamplesDataSource2.Insert()
End If
Next

View 1 Replies

Web Forms :: Procedure Or Function Usp Insert Has Too Many Arguments Specified

May 7, 2015

I am inserting data in 4 tables using one stored procedure so am getting one error  like this....

Procedure or function Usp_insert has too many arguments specified ..so what should i do ...

View 1 Replies

DataSource Controls :: Procedure Or Function Insert_Course_edit2 Has Too Many Arguments Specified

Mar 15, 2010

I dont understand why this is occurring, my store pro worked ok before (and i am very sure i am not passing too many arguments to the store pro) but since i have switched to using a "formview"control it has stopped. store pro and ASP.NET with sql data source are shown below. Apologies if the formatting nacks up.

View 3 Replies

Forms Data Controls :: Procedure Or Function SubmitVendor3DItem Has Too Many Arguments Specified

Mar 2, 2010

I am using Visual Studio 2005, and VB.NET. I am using a FormView. I have the default mode set to Insert. I fill out the info and click on the Add button and get this error. I have turned Trace on in the page and written suggested code to output the parameters. The parameters exactly match those in the stored procedure in SQL Server 2005. They are even in the same order.

This is my second attempt. First I had the FormView in normal mode. But there are no records yet and I was getting errors due to that. I tried the EmptyData template to no avail. So I decided to make a page that is only for adding new records. I removed the Select template. I have seen posts elsewhere for this error, but they all are concerning the use of a GridView, which I'm not using for this. I am really confused (not the first time). Is the lack of the Select template a problem? When it was still there it was still giving this error. The select statement had the same parameters. The first parameter is a Control parameter, value taken from a hidden field on the form. This worked for another FormView on a different page, so I'm really confused why I can't get this to work.

View 4 Replies

Forms Data Controls :: Procedure Or Function Updaterosterbyrow Has Too Many Arguments Specified

Feb 8, 2011

Procedure or function updaterosterbyrow has too many arguments specified

[Code]....

View 3 Replies

Forms Data Controls :: Procedure Or Function Has Too Many Arguments Specified - Updates Orderhistory

Aug 6, 2010

I have a stored procedure that updates orderhistory. When I test it from Enterprise Manager, that sucker works fine. But when accessing it from asp.net I get the following error... Procedure or function sp_UpdateOrderHistory has too many arguments specified. From my aspx page I created a gridview, enabled editing, deleted the columns I didn't want displayed. I specified the datasource, pointing at the sp for updating. So far so good..

I can click on Edit, and the edit fields are shown, but when I click UPDATE, the above error is generated. I've checked the sp parameters and they match (as far as I can tell) the update paramters in the page. Not sure why this is failing to update?

[Code]....

Here's the stored procedure...

[Code]....

View 6 Replies

SQL Server :: Stored Procedure - EXECUTE And EXECUTE Sp_executesql

Mar 10, 2011

I am looking through a sql stored procedure which I might need to update in the near future. Basically the stored procedure is about 20 lines long. The stored procedure first builds a query

and stores it in a variable named "@Sql". And then for the last two lines of the stored procedure it appears that the big sql statement stored in "@Sql" is executed by using the "EXEC" command. See below. What is confusing though is that the query appears to be exectuted twice? Why was the query written in this way. Don't both lines do the same thing? Why is it being done twice? Could this possibly be a mistake on the
part of the person who wrote the query. Below are the two lines I am talking about?

EXEC sp_executesql @sql
EXEC (@sql)

View 4 Replies

DataSource Controls :: Procedure Or Function "editdoc" Has Too Many Arguments Specified?

May 10, 2010

Procedure or function "editdoc" has too many arguments specified?

Stored Procedure: set ANSI_NULLS ON

View 2 Replies

SQL Server :: Pass Value Stored In Database As Arguments To A Function?

Feb 26, 2011

is it possible to pass value stored in database as arguments to a function...

View 4 Replies

SQL Server :: Have A Stored Procedure Execute Another Stored Procedure During Time Period?

Jan 28, 2011

I could probably figure this out if I tried to, but I have been working so long on code, I'm a little fried

I have a stored procedure, and I want to execute another stored procedure during a time period of lets say 1/1/2011 to 12/31/2011

How Would I accomplish this?

View 4 Replies

SQL Server :: When Try To Execute The Procedure It Throws An Error

Oct 20, 2010

Having big problems with a stored procedure I'm trying to write. It seems really simple but when I try to execute the procedure it throws an error.

Here is the proc:

[Code]....

[Code]....

View 6 Replies

SQL Server :: How To Open And Execute Stored Procedure

Aug 10, 2010

how to lock a stored procedure..

if its lock how to open and execute that stored procedure..

View 2 Replies

SQL Server :: Can Execute Different Queries In A Stored Procedure Same Time

Jan 11, 2011

In my stored procedure there are 8 queries for 8 tables.Each query has joins and sub queries. I am passing parameters & stored procedure name from front end(designed in asp.net 3.5) can we execute that 8 queries at the same time i.e. parallel execution so that I can minimize stored procedure execution time?

View 6 Replies

SQL Server :: Cannot Find Execute Any Query, Stored Procedure Not Found Even If It Is There?

Nov 3, 2010

I am getting frustrated with this problem, I dont know what i did, but now I cannot execute any stored procedured when I could last time.When I use my asp.net application to run the query, it finds the stored procedure but when I execute it is sql management studio it says it cannot find the stored procedure even though it is there.I tried to execute other procedures and the samething happens. Even when I try a simple query it says it cannot find the tableI could execute the query if i placed Use [databasename] in front, but even with this, I cannot execute stored procedures.

View 12 Replies

SQL Server :: How To Write Stored Procedure For Insert Data & Execute It In MS SQL

Oct 13, 2010

How to write Stored Procedure for Insert Data & Execute it in MS SQL?

Some websites:

[URL]

View 4 Replies

SQL Server :: Script To Execute Stored Procedure And Send Email?

Nov 12, 2010

Has anyone ever wroye a script that will execute a stored procedure and a function with the .Net Framework that sends email?

View 6 Replies

DataSource Controls :: Execute Stored Procedure On Linked Server?

Apr 22, 2010

i need to execute stored procedure on linked server (create procedure on linked server). i had try with this:

[Code]....

SQL code is looking like this

[Code]....

UDBV68 is linked server... Now, when i execute procedure from asp.net i got error 'Incorrect syntax near 'GO'.', but sql server doesn't report error...

Dbcall has value = "EXECUTE ('Create Procedure SelectOne as Select * From FixitOnline.Os_node ',952) AT UDBV54; GO"

View 5 Replies

SQL Server :: How To Execute Stored Procedure From Front End Without Passing Values To Optional Parameters

Jan 29, 2011

In my stored procedure I have declared some parameters as NULL values(Optional Parameters).

In my C#.NET code I didn't use the parameters to pass values to Stored Procedure's NULL

Parameters. So I am getting Exception.

I don't want to pass parameters from my code.Because I have declared 30 parameters in my

Stored Procedure as NULL values.

Is there any other way to execute Stored Procedure from Front End without passing values to

Optional Parameters in SQL stored procedure?

View 4 Replies

DataSource Controls :: EXECUTE Permission Error On SQL Server 2005 Stored Procedure When Running From The IIS?

Apr 10, 2010

sing VS 2008 at a workstation, I have successfully developed a local, file-system ASP.NET 3.5 website. The wbesite included a membership page with Windows authentication and a web parts page. The SQL Server 2005 ASPNETDB database has been created at an IIS web servr. Using the ASP.Net development server of the workstation, both the membership Membership/WebParts pages at the local website worked very well.

Then, I copied the website to a virtual directory at the IIS web server and creates a remote website for the workstation. Under theASP.NET development server of the workstation, both membership and webparts pages of the remote website at the IIS web server also worked fine.

However, when running these web pages from the IIS web server machine, something wrong happened with the web parts page. (The membership page still worked very well.) For the ASPNETDB database at the IIS web server machine, there is an EXECUTE permission error on an ASPNET stored procedure.

What are the differences between the ASP.NET development server and IIS web sever, which caused the EXECUTE permission error on the ASP.NET S.P.? How to find and fix the errors?

View 2 Replies

Forms Data Controls :: How To Execute Jquery Function With Gidview Button Or From Server Side

Jan 19, 2011

How can I trigger a jQuery function with the Gridview Select button? I want that the select button trigger the jquery function that has the row details (it's already working with a asp:buttonfield ), and select the row so i can get the values and send it trough e-mail with another button. I don't know if this is possible. or, Can I trigger the jQuery function from code behind with the select button Sub? How?

[Code]....

This function capture the gridview cell values that are hidden and show them in a div outside the gridview (it works as row details). I have no problem with this.

[Code]....

All i need is a button that select the row index and/or values and trigger the jquery function . Or I can execute the jQuery function from server side. I don't know if it's posible.

View 1 Replies

SQL Server :: Stored Procedure With Scalar Function Slow?

Mar 11, 2011

I have the following sp that uses a scalar function to get the cost of a product

The procedure calculates profit of each bill,and using two tables

1 - Estimate Header

2- Estimate details

For each estimate invoice sp will compare items profit by comparing items rate with the rate it is purchased.I use a Scalar sql Function to get the Purchase Cost of each item in an invoice.This fuction cause the slow execution

Can this scalar function be replace with something else to get this sp execute faster....now it taking around 25 seconds there is only 1100 invoice in the database.

select BillNumber,sdate [Date],case when t1.Customer = 0 then 'Account Payable' else t2.AccountName end Customer ,case when t1.CashOrCredit = 0 then 'Cash' else 'Credit' end CashOrCredit,(select Sum(gross) from EstimateDetails where billNumber = t1.BillNumber)Gross,t1.netDisc,(select sum(TaxAmt) from EstimateDetails where billNumber = t1.BillNumber)Tax,t1.Ces, Amount,t1.roundOff,Paid Payment,

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved