C# - SQL 2000 - Error - Procedure Or Function "name" Expects Parameter "@param" Which Was Not Supplied

Jul 19, 2010

I 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

View 1 Replies


Similar Messages:

Procedure Or Function Expects Parameter Which Was Not Supplied?

Apr 7, 2010

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]...

View 1 Replies

Web Forms :: Procedure Or Function Expects Parameter Which Was Not Supplied

Jul 28, 2012

getting this error while inserting near ExecuteNonQuery(); Procedure or function 'Transaction' expects parameter '@idcount', which was not supplied.

View 1 Replies

Forms Data Controls :: Procedure Or Function 'deleteArticleAttachment' Expects Parameter '@articlefileid', Which Was Not Supplied

Jun 16, 2010

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]....

View 3 Replies

DataSource Controls :: Procedure Expects Parameter Which Was Not Supplied?

May 11, 2010

I keep getting this error:

Procedure 'cnpcpiFarmFormAssignField' expects parameter '@chUserId', which was not supplied.

[Code]....

View 4 Replies

ADO.NET : Receive The Error [Procedure Or Function 'search' Expects Parameter '@name',?

Nov 11, 2010

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"

View 1 Replies

Oracle 11g Stored Procedure - Expects A Parameter As A Number, But Receives A String?

Mar 23, 2011

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).

View 1 Replies

Databases :: Procedure Espects Parameter Which Was Not Supplied?

Aug 6, 2010

I have the following code to fill a dataset

Dim cn As New OdbcConnection(ConfigurationManager.ConnectionStrings("csSybaseGuille").ConnectionString)

View 3 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

What Function To Use Submit A Param In URL That Contains '&' W/o Using %26

Jul 14, 2010

When I do window.open(url), I have to manually replace a value inside that url that contains '&' by '%26'. I am wondering whether there is a function on ASPNET side that I can manipulate that param value that contains '&' to containing '%26' without doing in javascript window.open(). URLEncode does not work nor URLPathEncode!

View 3 Replies

Passing JSON To A PageMethod That Expects A List<T> Parameter?

Jan 13, 2010

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?

View 1 Replies

DataSource Controls :: Catch Don't Catch Any Error From SQL 2000 Transition Store Procedure

Feb 7, 2010

Here is the code copied from [URL] In asp.net code behind, I use try-catch try to catch any error but never catch it. In SQL database, if I rename Employees to Employeesx or change column DepartmentID to DepartmentIDx, record will not be deleted (it is right) without any error (it is wrong, suppose catch an error).

CREATE PROCEDURE DeleteDepartment
(
@DepartmentID int
)
AS
BEGIN TRANSACTION
DELETE FROM Employees
WHERE DepartmentID = @DepartmentID
IF @@ERROR <> 0
BEGIN
ROLLBACK
RAISERROR ('Error', 16, 1)
RETURN
END
DELETE FROM Departments
WHERE DepartmentID = @DepartmentID
IF @@ERROR <> 0
BEGIN
ROLLBACK
RAISERROR ('Error', 16, 1)
RETURN
END
OMMIT

View 2 Replies

Web Forms :: Crystal Report Asks For Parameter At Runtime Even-though Supplied?

May 30, 2012

i 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]......

View 1 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

Paging Implementation In C# Using Stored Procedure (SQL 2000)?

Jul 16, 2010

Anyone with a link to a sample code with paging that can be changed to work within a (10000+ records) table? I want to display the records on my asp.net page.

View 3 Replies

How To Move Stored Procedure From SQL Server 2000 To 2005, Multiple Table Insert

Jul 21, 2010

moving some tables & stored procedures from SQL Server 2000, to SQL Server 2005.So far so good, but I've come across a problem with this stored procedure:

CREATE PROCEDURE [dbo].[user_insert]
@user_service_unit int,
@user_champion_1 varchar(50),
@user_champion_1_nt varchar(10),
@user_champion_2 varchar(50),
@user_champion_2_nt varchar(10),
@user_champion_3 varchar(50),
@user_champion_3_nt varchar(10),
@user_date_received datetime,
@user_requestor varchar(255),
@user_info_requested text,
@user_expiry_date datetime,
@user_10_days datetime,
@user_5_days datetime,
@user_2_days datetime
[code]...

View 3 Replies

DataSource Controls :: SQL Server 2000 - Event Log Error Id - 318

Jan 7, 2010

Unable to read local eventlog (reason: The data area passed to a system call is too small). This error is recorded in the event log every minute in the production server, and because of this the SQL Server 2000 performance is very slow and the box is also working slow. This indirectly affects my application and productivity.

View 2 Replies

SQL Server :: Attaching The Database Error In Both 2000 Aswell As 2005?

Jan 13, 2011

For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Could not find row in sysindexes for database ID 14, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes. Could not open new database 'BILL'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)

For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=602&LinkId=20476

------------------------------
BUTTONS:

OK

i have both sql2000 & 2005 on my system
i want attach tha database in sql2005.
if in case the database was mad ein sql2000 how do i attach in sql2005
or wht can be done??

View 6 Replies

SQL Reporting :: Error Upgrading From Server 2000 - 2008 R2 Services

Oct 6, 2010

I am having some trouble upgrading an existing SQL Server 2000 Reporting Services installation from an old server to a new one commissioned for this purpose, which is running SQL Server 2008 Reporting Services. I have been following the instructions here: [URL] but after trying to connect with reporting services 2008, i get this error: The version of the report server database is either in a format that is not valid, or it cannot be read. The found version is 'C.0.6.54'. The expected version is '147'. (rsInvalidReportServerDatabase) before starting the process, I ran upgrade advisor and got back the following results:

Description Setup can upgrade a SQL Server 2000 Reporting Services instance that uses a SQL Server 2000 Database Engine in the same instance. However, upgrade is blocked if the report server database is in a different instance, on a remote instance, or runs on a remote SQL Server 2005 instance in SQL Server 2000 compatibility mode.

*****
*note, our reporting services IS in the same instance as the SQL Server 2000 database engine. However, upgrade advisor still reported that this instance can not be automatically upgraded.
*****

Corrective Action Choose either approach to continue with the upgrade: Upgrade the Database Engine instance on the remote computer before upgrading Reporting Services. The server cannot be in SQL Server 2000 compatibility mode after upgrade. Move the reportserver and reportservertempdb to a SQL Server 2005 or SQL Server 2008 Database Engine instance, and then use the Reporting Services Configuration tool to connect the report server to the database.

so, I went with option 2, move the database then connect. I have: -backed up the ReportServer and ReportServerTempDB databases from the old server, transferred them to the new and restored them to the 2008 Server as ReportServerOld. -I then renamed the old database to ReportServer and ReportServerTempDB, as this is required to use the database as a source apparently. I had to of course change the existing database names to ReportServerNew to perform the rename. I backed up the symetric key for this installation using the rskeymgmt utility...............

View 2 Replies

C# Run A Procedure Without Specifying A Parameter Name?

Mar 3, 2011

How can I execute a stored procedure that takes in parameters without having to specify the prameters name? The name of the parameter in the stored procedure may change from CustomerID to CustID so I don't want to have to keep changing my code.Rather than doing what is provided below where you specify the parameter name -
command.Parameters.Add("@dtStart", SqlDbType.DateTime);
command.Parameters["@dtStart"].Value = startDate;
command.Parameters.Add("@CustomerID", SqlDbType.NChar);
command.Parameters["@CustomerID"].Value = customerID;

I am looking to do something like this -

command.Parameters.Add(startDate, customerID);

View 5 Replies

C# - Modify Stored Procedure Parameter Value?

Feb 4, 2011

My Stored procedure takes one parameter @IDs and it has values in it like '1,2,3'. I want to get rid of these single quotes. How can I do it? Like I want just 1,2,3 and NOT '1,2,3'. How do I modify this parameter value inside my SP?

View 3 Replies

Passing A Parameter To Stored Procedure In C#?

Mar 23, 2011

When I try the following:

[Code]....

I get an error saying No overload for Add method takes 2 arguments. HOw would i pass the PaycheckID in then as a paramter?

View 2 Replies

DataSource Controls :: SQL Parameter Not Being Sent To Procedure

Aug 3, 2010

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="<%&#36; ConnectionStrings:connectn %>"
SelectCommand="Onsite_Report_Procedures"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="@rptNum" Type="String" />
</SelectParameters>
</asp:SqlDataSource>

[Code]....

View 2 Replies

How To Specify Parameter Value For Stored Procedure In SqlDataSource

Mar 16, 2011

Being new to using the declarative syntax of SqlDataSource I am trying to figure out a way to set the value of a parameter to a stored procedure. I have a Client_ID that is passed via the Request Object and I need to set the Client_ID before the stored procedure of the SqlDataSource is executed.

Does the stored procedure parameter have to be predefined in the ASPX markup or can it be added dynamically in the code-behind? Would anyone have an example that demonstrates the SqlDataSource markup with a stored procedure and parameter as well as setting that parameter value in code-behind?

View 1 Replies

SQL Server :: How To Add An Output Parameter To A Stored Procedure

Oct 7, 2010

how do I add an output parameter to a Stored Procedure that returns a code or string to the calling app

View 1 Replies







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