Forms Data Controls :: Procedure Or Function Updaterosterbyrow Has Too Many Arguments Specified
Feb 8, 2011Procedure or function updaterosterbyrow has too many arguments specified
[Code]....
Procedure or function updaterosterbyrow has too many arguments specified
[Code]....
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.
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]....
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 Repliesi 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();
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 ...
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);
}
}
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]....
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
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
Procedure or function "editdoc" has too many arguments specified?
Stored Procedure: set ANSI_NULLS ON
I have been stuck on how to pass multiple to a JavaScript function in a item template of a list view. Below is my code. Does anyone know the process?
[Code]....
How can I get the delete method to work? I keep getting an error:
"Procedure or Function 'deleteArticleAttachment' expects parameter '@articlefileid', which was not supplied."
[Code]....
is it possible to pass value stored in database as arguments to a function...
View 4 RepliesI am trying to write a function that can be called to run a stored procedure. I pass the stored procedure name, followed by as many parameters as I need to run the procedure. I am able to do this by using the params keyword, so my function looks something like this;
[Code]....
How can I determine what the data type of the parameter is? Maybe I need to alter the string[] part, above?
i am developing a webaaplication ASP.net using C# and MYSQL as backend..
i am facing problem to execute this query in MYSQL:
SELECT ID, Date, Event, Remark, school, section, class, schooltype, shift
FROM sessioncalendar
WHERE (school = 'SECONDARY SCHOOL') AND (class = 'IX') AND (section = 'B') AND (shift = 'SHIFT I') AND (schooltype = 'XYZ School')
AND MONTH ( Date )= '6'
AS the query works well wethout addind AND MONTH ( Date )= '6' ... but when i add this line query generate error
( Error in list of function arguments: ')' not recognized. Unable to parse query text.)
While same query is working successfully with Sql Server 2005...but i hvnt found any reason why my query is not working with Date(datetime) column..i hv google about it..but i found synatax is same in both SQL SErver 2005 and MY SQL syntax
I have a gridview with sqldatasource
[Code]....
and on deleting I have
[Code]....
I have a Procedure to return some data from database an it need just Application name that be add from Web.config
i alredy created a function to return the data but once of column if GUID an i got this error:
Unable to cast object of type 'System.Guid' to type 'System.Data.DataTable'.
my code is:
[Code]....
I am trying to add 2 binds to a CommandArgument so both are passed.
[Code]....
[Code]....
i have a stored procedure with this values and i need just to make a button that will send something to "Equip" column,how to do it? write the values on my webpage and make a button to exec the procedu
I have a gridview with item template and I want the text in that item template label to come from a method in a code behind.
Here is my gridview:
[Code]....
[Code]....
[Code]....
I want to call this method but I'm getting the errors: "
"The best overloaded method match for 'employeepayment.RegTime(string)' has some invalid arguments"
"Argument '1': cannot convert from 'object' to 'string'"
Someone know the answer?. I thought I was right to use Eval.
I have problem with a stored procedure and function that return the same shape, but as they are different methods LINQ won' t let me cast between the two. Please see code for the two SPROCs below (This is actually simplified to represent the problem, so please don't spend lots of time explaining alternative ways of writing the function/sproc.)
Table Valued Function
"getCategories()"
SELECT categoryName, categoryID FROM categories
SPROC "getUnusedCategories"
SELECT categoryName, categoryID FROM CategoryInstances cI
FROM dbo.SMAN_getCategories(@SiteMANID, @SectionID) c
LEFT JOIN @EntityResultsTable er
In the procedure function, there will be queying several times based on conditions.
Suppose each query retrieves several records, can I caumulate those records in on table, then return that table.
Benifit I want to success here is that I want to save time, so instead of making several functions each has one query, each one requires a connection to databae, so it will take time.
getting this error while inserting near ExecuteNonQuery(); Procedure or function 'Transaction' expects parameter '@idcount', which was not supplied.
View 1 RepliesI have a table with recursive relation,a function and a sp for readig data from that table:
[Code...]
When I execute sp,I got this error:Maximum stored procedure,function,trigger or view nesting level exceeded (limit 32).