DataSource Controls :: Procedure Expects Parameter Which Was Not Supplied?
May 11, 2010I keep getting this error:
Procedure 'cnpcpiFarmFormAssignField' expects parameter '@chUserId', which was not supplied.
[Code]....
I keep getting this error:
Procedure 'cnpcpiFarmFormAssignField' expects parameter '@chUserId', which was not supplied.
[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]....
Driving me mad on a personal project; I know I've done this before but elsewhere and don't have the code. As far as I can see, I'm setting the parameter, I'm setting its value, the connection is open, yet when I try to fill the dataset I get the error 'Procedure or function expects parameter "@test" which was not supplied'. (This is obviously a simplified test! Same error on this or the real, rather longer code though.)
C#:
SqlCommand l_oCmd;
DataSet l_oPage = new DataSet();
l_oCmd = new SqlCommand("usp_test", g_oConn);
[code]...
getting this error while inserting near ExecuteNonQuery(); Procedure or function 'Transaction' expects parameter '@idcount', which was not supplied.
View 1 RepliesI have a stored procedure which is declared as follows: ALTER PROCEDURE dbo.thisProc @ID int,@TypeID int, @DocID int, @Section varchar(10) What I need is to be able to do this: If @ID is supplied, execute a particular if block if @ID is not supplied then move check if @TypeID is input and then execute another if block. I don't want to write multiple sql queries to deal with different inputs/page sections that a user is viewing.
SAMPLE CODE:
CREATE PROCEDURE GetArticle
@ID int,@DoTypeID int, @DocID int, @Sec varchar(10)
AS
IF @ID IS NOT NULL AND , @DocID IS NOT NULL AND @Sec = 'inner'
BEGIN
SELECT "my query is here"
WHERE Articles.ID = @ID AND Articles.DocID = @DocID
END
ELSE IF @ID IS NULL AND @DocID IS NULL AND @Sec = 'list'
BEGIN
EXEC GetDocList @DocTypeID
END
ELSE IF @ID IS NULL AND @DocID IS NULL AND @Sec = 'full'
BEGIN
EXEC GetDocList @DocTypeID
END
I have finally got my paging code for a datalist to work correctly. However, the stored procedure I use receives a Parameter called 'name' which is a VarChar 4. I'm having a little trouble implementing the handling of the 'name' parameter in the following code. I receive the error [Procedure or function 'search' expects parameter '@name', which was not supplied.]
Private Sub DataBind()
Dim objConn As New SqlConnection(ConfigurationManager.ConnectionStrings("SQL2005_504887_2onetennisConnectionString").ConnectionString) [code]....
I think it will look something like the following but I'm not sure because this syntax doesn't look like it would work with my above code.
cmdTest.CommandType = Data.CommandType.StoredProcedure
cmdTest.Parameters.Add(New SqlParameter("@TestParam", Data.SqlDbType.VarChar, 10))
cmdTest.Parameters("@TestParam").Value = "Testing"
we recently upgraded an application (.NET 2.0) that we maintain to use Oracle 11g. The application uses MS Enterprise Library 2.0. We've found that when the database.ExecuteNonQuery(Oracle.DataAccess.Client.OracleCommand) method is called, it bombs when the stored procedure expects a parameter as a number, but receives a string. This didn't happen prior to upgrading. If I cast the parameter to an Int, I don't recieve the error. Was something possible missed during the upgrade? The issue occurs regardless if we are hitting an 11g database, or a 10g database.
EDIT: I neglected to mention that this same issue does not occur when ExecuteDataReader is called (handles implicit conversion of the datatype).
I have the following code to fill a dataset
Dim cn As New OdbcConnection(ConfigurationManager.ConnectionStrings("csSybaseGuille").ConnectionString)
What am i missing or doing wrong here, when i debug, im seeing the selected value in the code behind, but when the page loads, it says the following:
Procedure or function 'Onsite_Report_Procedures' expects parameter '@rptNum', which was not supplied.
<asp:SqlDataSource
ID="SQLOnSiteReport"
runat="server"
ConnectionString="<%$ ConnectionStrings:connectn %>"
SelectCommand="Onsite_Report_Procedures"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="@rptNum" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
[Code]....
how can i pass a session variable in a C# web form to a stored procedure..?
View 1 RepliesI have stored procedure that increments a number. I am supposed to use the newly generated number and insert it into a table. My question is how do I execute the stored procedure, with a hardcoded value of 3 that it expects as a paramter, receive the number it generates as the output parameter and use it in the insert statement.
Here is the stored procedure code:
CREATE PROCEDURE [dbo].[Generate]
@myid int,
@next_no int output
AS
update mytable
set mynumber=mynumber + 1, @next_no = number
where myid=@myid
RETURN
Here is my insert statement, that I tried and it failed:
EXEC @GetNo = Generate '3'
Insert into customers (custid, name, phone ) values
( @GetNo, 'MSFT', '800-345-5678')
I have a Datatable and I want to send it in SqlServer as Parameter in stored procedure.
1. How i send datatable
2. How I use that datetable in sqlserver to read its data.
How do you call a stored procedure using C# .NET 3.5 that contains a parameter that is of type hierarchyid in SQL Server 2008?
A basic outline of my current code is as follows:
SqlConnection conn =
new
SqlConnection(DatabaseConnectionString);
SqlCommand StoredProcedureCommand =
new
SqlCommand("AddUser", conn);
StoredProcedureCommand.CommandType =CommandType.StoredProcedure;
SqlParameter ParamUsername = StoredProcedureCommand.Parameters.Add("@Username",
SqlDbType.NVarChar);
SqlParameter ParamPassword = StoredProcedureCommand.Parameters.Add("@Password",
SqlDbType.NVarChar);
SqlParameter ParamMasterNode = StoredProcedureCommand.Parameters.Add("@MasterNode",
SqlDbType.Text);
// HierarchyID type
ParamDynamboUsername.Value = Username;
ParamPassword.Value = Password;
ParamMasterNode.Value = "/";
conn.Open();
StoredProcedureCommand.ExecuteNonQuery();
conn.Close();
i am a new bee in SQL Server 2005. I have a stored procedure that accept two parameter , variable @ColumnName as column name and @SearchText as search text.
My stored procedure is written as below:
[Code]....
but the error i get is "The 'usp_GetPlantTest' procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead."
ALTER procedure [dbo].[Sample2]
@Col as nvarchar(1000),
@Value as nvarchar(1000)
[code]...
I am using DAAB with stored procedures. I use stored procedures more then once if possible. If I add a parameter later in stored procedure, I have to supply value for this in functions where it is even not being used as well, other wise it shows an error that number of parameters are not same. if I add parameter in last of parameter list in stored procedure and set a default value for it and I may have not to provide value for this from functions where I am not using it.
View 1 RepliesI spent about 60 minutes sifting through search engine listings trying to figure this out and couldn't find an answer, so I decided to make this post for others.
Situation: Using a Stored Procedure to insert a row and return the new row ID, explained here. In my case, I used the Idenity_Scope to return the new row, like so:
[Code]....
Next, following steps as described in link above, went into the dataset XSD page, configured the table adapter to use this stored procedure. By default, it wanted my return value to be set to some value, but I set to allow Null (makes sense, since I don't want to pass the value in, I want to get it out, so it should be null to begin with).
Problem: Where I ran into an issue was in the method to call this stored procedure. The intellisense displayed the prototype it was expecting, basicly like this:
[Code]....
I have an sp that I would like to us the data from one column to use as a parameter for the following Select Statement
[Code]....
need to set the @customerID parameter = customer_data.CustomerID from the first Select Statement
I have an ASP.NET PageMethod with the following signature:
<WebMethod()> _ Public Shared Function SaveCodes(ByVal codes As List(Of Code)) As String
I am trying to pass a JSON object to the PageMethod from the client side, but I get an error that the type String cannot be converted to type of List<Code>.
Here is the json that I'm building on the client and sending to the method:
[code]....
I have been able to pass in simple data types and a single instance of the Code class, but I can't seem to find the magin to pass a List to the server method. Can anyone show me what I'm doing wrong?
i want to return two output parameter n temp table from sql server stored procedure
View 6 Repliesi have the below code for passing parameters to crystal reprot & displayin g the report
1) even though i am passing parameter values i get a screen where its asking for the values
Parameter Field(s)
dept
Value
need to avod this
when the page is loaded no parameter values are passed
2) after enetring the value in the textbox when i click submit i get th e logon error
customerReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
ParameterFields paramFields = new ParameterFields();
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); paramField.Name = "dept"; paramDiscreteValue.Value = drpdept.SelectedItem.Text; paramField.CurrentValues.Add(paramDiscreteValue); paramField.Name = "emp"; paramDiscreteValue.Value = drpemp.SelectedItem.Text;
[Code]......
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
I want to apply other stored procedure select query on result of first stored procedure.
View 1 RepliesThis is surareddy. i nead some small clarification in the "Stored Procedure"
how to convert the oracle Stored Procedure to sqlserver2005/2008 Stored Procedure.
right now i am enhancing the project that project already developed the oracle Stored Procedure. now our company is using sqlserver 2005/2008.
how to convert the Oracle Stored Procedure to sqlserver 2005 Stored Procedure
Initially, I have tried to use stored procedure. But I changed my mind and preferred to call sql query in codebase with command text. However, it stills tries to find initially-called stored procedure (which is neither called or exists).I think that it is related caching. But I tried it with different browsers it did not work.What might be the reason?
View 4 Replies