473,785 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MSSQL expects parameter error, but it is supplied

2 New Member
I have a SP running on mssql server 2005. When I try to execute the SP through asp I receive back an error that the parameter @City is not supplied, although I clearly do supply it.

Here is my code:

SP:

CREATE PROCEDURE [dbo].[AddResort]
@Id int output,
@Name varchar(100),
@Comments text = NULL,
@Street varchar(100) = NULL,
@Street2 varchar(100) = NULL,
@City varchar(100),
@State varchar(2),
@Zip varchar(11) = NULL
AS
BEGIN
SET NOCOUNT ON;

INSERT INTO resorts (name, comments) VALUES (@Name, @Comments);
SELECT @Id = SCOPE_IDENTITY( );
INSERT INTO resort_address (resort_id, street1, street2, city, state, zip) VALUES
(@Id, @Street, @Street2, @City, @State, @Zip);

SET NOCOUNT OFF;
END

/*************** *************** *************** *************** *************/

Here is the relevant code of the webpage:

Tracer.Add ("[Resort] Save - Inserting New Resort")

' insert into database
set conn = Server.CreateOb ject("ADODB.Con nection")
conn.Open application("db con")

set cmd = Server.CreateOb ject("ADODB.com mand")

cmd.ActiveConne ction = conn
cmd.CommandType = 4
cmd.CommandText = "AddResort"

on error resume next

cmd.Parameters. Append cmd.CreateParam eter("@Id", 3 , 2)
cmd.Parameters. Append cmd.CreateParam eter("@Name",20 0, 1, 100, m_cName)
if (not isempty(m_cComm ents) or len(m_cComments ) > 0) then
cmd.Parameters. Append cmd.CreateParam eter("@Comments ", 200, 1, len(m_cComments )+1, m_cComments)
end if

if (len(m_cStreet) <> 0) then
cmd.Parameters. Append cmd.CreateParam eter("@Street", 200, 1, 100, m_cStreet)
end if

if (len(m_cStreet2 ) <> 0) then
cmd.Parameters. Append cmd.CreateParam eter("@Street2" , 200, 1, 100, m_cStreet2)
end if


cmd.Parameters. Append cmd.CreateParam eter("@City", 200, 1, 100, m_cCity)
cmd.Parameters. Append cmd.CreateParam eter("@State", 200, 1, 2, m_cState)

if (len(m_cZip) <> 0) then
cmd.Parameters. Append cmd.CreateParam eter("@Zip", 200, 1, 11, m_cZip)
end if

dim param
for each param in cmd.Parameters
' prints all parameters correctly!!!!!
Tracer.Add ("Added parameter " & param.Name & ": " & param.Value)

next

cmd.Execute()

m_nId = cmd.Parameters( "@Id").Valu e

if (err.number = 0) then
Tracer.Add ("[Resort] Save - Saved")
m_bIsDirty = false
m_bIsNew = false
Save = true
else
Tracer.Add ("[Resort] Save - Insert Error: " & err.number & "; Desc: " & err.description )
Save = false
end if

on error goto 0

set cmd = nothing
conn.Close: set conn = nothing
Nov 2 '07 #1
0 1471

Sign in to post your reply or Sign up for a free account.

Similar topics

1
12864
by: Mini Mouse | last post by:
Hiya folks, I'm getting the following error(s) below and I'm at a bit of a loss as to how to correct it. When I give it a parameter it then complains it needs two parameters and the second one being an integer or something like that. Warning: domdocument() expects at least 1 parameter, 0 given in orders.php on line 157
7
23876
by: mj | last post by:
Hello, thanks for the help. I am running a WinXP Pro w/ SP2 (my home computer, with ZoneAlarm firewall) Apache 2.0.52 MySQL 4.1.7 PHP 5.1.0-dev I have developed a PHP/MySQL web app that tracks jobs for me, and we
1
3232
by: Senthil | last post by:
Hi, I created a stored procedure in the sql server. I try to insert a record from the aspx page. But I keep getting this error, "procedure expects parameter <@firstname>, which was not supplied". This is what I am doing. cmd.CommandText = "proc_insertuser"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@firstname", SqlDbType.VarChar, 50);
8
14020
by: Yusuf INCEKARA | last post by:
I have a stored procedure : CREATE PROCEDURE STP_GETSTORELIST @RETCUR CURSOR VARYING OUTPUT AS set @RETCUR = CURSOR FORWARD_ONLY STATIC FOR SELECT ID,STORE_NAME FROM T_INF_STORE ORDER BY STORE_NAME OPEN @RETCUR
0
4136
by: printline | last post by:
Hello! I am not at all good at sql, so can anyone tell me what this error i get means....... Warning: mssql_query(): supplied argument is not a valid MS SQL-Link resource in d:\WebHoteller\printline\www\bacon\login.php on line 19 Warning: mssql_fetch_array(): supplied argument is not a valid MS SQL-result resource in d:\WebHoteller\printline\www\bacon\login.php on line 20 Warning: mssql_query(): supplied argument is not a valid MS...
1
6877
by: jfturcott | last post by:
Prepared statement '(@p1 int,@p2 tinyint,@p3 varchar(8000),@p4 varchar(8000),@p5 bit' expects parameter @p1, which was not supplied. I get the above error when trying to update a datagridview to the sql database. I am using the commandbuilder because the datagridview can be saving 8 different types of data (to different tables) depending upon the selection made in a Treeview control. The same code without the parameters line works...
0
5939
by: Maneesh Agarwal | last post by:
I am trying to pass a parameter to dynamically populate drop down list. I am not able to pass the parameter from my .aspx file. Here is the grid view and related ObjectDataSource. In srcLocation, the Company paramter being passed is blank or null, if I put default value (hardcoding what is expected), the page display fine when I click on edit button. But with no default value it gives above error. <asp:GridView id="grdCAPAs" ...
7
1348
by: Cirene | last post by:
I have a stored procedure named insertcompany. I keep getting the error: Sys.webforms.pagerequestmanagerservererrorexception: Procedure or function 'InsertCompany' expects parameter '@ApptPhone1Required', which was not supplied. But, I DID supply it along with all others.... (here's a snippet) MyCommand.Parameters.AddWithValue("@InstructionsOperator",
7
5166
by: roseple | last post by:
Hi, can anyone please help me why I got this error every I uploaded files. Error: Here is the code on the said warning message: # Gather all required data $name = mysql_real_escape_string($dbLink, $_FILES); $mime = mysql_real_escape_string($dbLink, $_FILES); $size = $_FILES;
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.