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);
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
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.
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 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 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 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.
i have a function which returns a value from a query string parameter, i use it in more than 10 places in the webapp thus i have to rewrite the code every time, again and again.so to make it short, is there any way i can embed the code somewhere and keep referring to it through out my app?
I'm using a CustomValidator control to validate some controls in a GridView. I have the validation working perfectly on the client and the server, but would ideally like to pass the GridView ID into the client function so I can move it out into a separate
.js file. The signature for my client function is:
function valOrder_ClientValidate(source, args) { // Code here}
And my CustomValidator control looks like:
[Code]....
Is there a way I can pass an additional parameter into this function?
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.
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 have a SQL table containing a timestamp column. This table is displayed in ASP using GridView control. The timestamp column is indicated in the DataKeyNames property of the GridView. I'm using TemplateFields for all columns and a ItemTemplate HiddenField control connected to the timestamp column using Eval.
The data is displayed properly. I'm trying implement the optimistic concurrency in C# using the value of above mentioned timestamp and a stored procedure. The SQL stored procedure expects the @timestamp as varbinary(8). I'm not sure how to pass the value of gv_hid_timestamp back to the stored procedure. I'm using the following:
resulting in the following error: "Input string was not in correct format." (I also tried different data types but with similar result). I want to be able to pass this parameter programmatically from C# and not have to specify it on the UpdateParameters list.
I have a label "lbl1" that I am trying to locate in a content page from the Master page. I want to do it dynamically so I am trying to pass the name of the control (which in this case is lbl1) through as a parameter. I don't get an error, it just doesn't work. If I do an alert to see what the string "temp" looks like, it is correct, but iit seems as if Javascript ignores it. I believe it has something to do with the '<%= not being interpreted correctly by the browser I'm sure it is a simple solution, but I can't figure it out!
I have a gridview inside a user control bind to an object datasource. Now I want to bind the object datasource with a parameter from parent page. For this purpose I defined a public property in user control but how do I pass it with object datasource? I am calling from parent page like myusercontrol.parameter=querystring["id"]; How to bind object datasource with my parameter?
I have a page with some datasources in it. I am doing reenginering of the page itself and would like to split some parts of the page in several user controls. In my code I have an ObjectDataSource object with the following params
This piece of code automatically bind the hidden field "txtAlbumId" to the datasource. In my revision this datasource should be moved to a user control. What is the best way to handle a scenario like this?
</textarea></p> <input type='hidden' name='ID[7]' value='34389' /> <input type='hidden' name='URL[7]' value='http://forums.asp.net/t/1627446.aspx' /> <input type='hidden' name='CAT[7]' value='Web Forms' /> <input type='hidden' name='BOARD[7]' value='microsoft' /> <input type='hidden' name='P_DATE[7]' value='Nov 26, 2010 08:25 PM' /> <input type='hidden' name='RANDOM[7]' value='UEVLcNi9r' /> <input type='hidden' name='REPLIES[7]' value='4' /> <input type='hidden' name='USER[7]' value='aziz' /> <p><input class=subject type='text' size='90' name='SUBJECT[7]' value='Web Forms :: How to parse a string variable for diplay in control' /><select name='INDEXED[7]'><option value='1' selected>UPDATE</option><option value='2'>DELETE</option></select>Nov 26, 2010 08:25 PM - Replies: 4 CAT: Web Forms<a target=_blank href="http://forums.asp.net/t/1627446.aspx">View</a></p> <p> <textarea rows=10 cols=100 name='POST[7]' onfocus='setSelRange(this, 0, 0)'/> How can i display the string variable data "234,345,567,678" into a listbox?
i wish to parse the delimited string as seperate items.
the string can vary in length. </textarea></p> <input type='hidden' name='ID[8]' value='175584' /> <input type='hidden' name='URL[8]' value='http://stackoverflow.com/questions/2866868/datasource-select-parameter-from-get-value' /> <input type='hidden' name='CAT[8]' value='ASP.NET' /> <input type='hidden' name='BOARD[8]' value='stackoverflow' /> <input type='hidden' name='P_DATE[8]' value='May 19 10 at 15:21' /> <input type='hidden' name='RANDOM[8]' value='XYAWdt1ps' /> <input type='hidden' name='REPLIES[8]' value='1' /> <input type='hidden' name='USER[8]' value='aziz' /> <p><input class=subject type='text' size='90' name='SUBJECT[8]' value='c# - DataSource Select Parameter from GET value' /><select name='INDEXED[8]'><option value='1' selected>UPDATE</option><option value='2'>DELETE</option></select>May 19 10 at 15:21 - Replies: 1 CAT: ASP.NET<a target=_blank href="http://stackoverflow.com/questions/2866868/datasource-select-parameter-from-get-value">View</a></p> <p> <textarea rows=10 cols=100 name='POST[8]' onfocus='setSelRange(this, 0, 0)'/>How can I use the value of a GET form value as a SelectParameter?
I just like to know how to pass a parameter to the datasource of my dllItemCodeFooter and dllItemCodeEdit Drowndownlist which calls my getItemCodeList(decimal categoryID) method in the code behind. The value of the parameter will be seletectedValue of the first dropdownlist ddlCategoryFooter or ddlCategoryEdit).I know it could be done in code behind, but i prefer to bind my datasource in asp page. I want to achieve something like this DataSource='<%# getItemCodeList(ddlCategoryEdit.Seletected)%>'
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?
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?