ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 16th, 2004, 07:48 AM
spc197's Avatar
spc197 spc197 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: North East of England
Posts: 23 spc197 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 m 28 sec
Reputation Power: 0
Question Getting my value from my stored proceedure

I have created my proceedure

CREATE PROCEDURE [dbo].[insaadress]
@address1 varchar(50),
@address2 varchar(50),
@address3 varchar(50),
@address4 varchar(50),
@postcode varchar(10),
@country varchar(50),
@addid bigint output
AS select @addid = (select max(addid) as maxadd from tbl_address)
insert into tbl_address (address1, address2, address3, address4, postcode, country) values (@address1, @address2, @address3, @address4, @postcode, @country)
return @addid
GO


and in SQL Query Analyser

declare @addid bigint
exec insaddress '75 Greta Road', 'Skelton', 'Saltburn By The Sea', 'Cleveland', 'TS12 2NF', 'UK', @addid output
select 'The new addid is : ', @addid as myadd
go


Returns

The new addid is : 1428

Which is fine .... but then I get to the ASP

<!--#include file="../../Connections/Conn.asp" -->
<%

Dim addadd__address1
addadd__address1 = ""
if(Request("address1") <> "") then addadd__address1 = Request("address1")

Dim addadd__address2
addadd__address2 = ""
if(Request("address2") <> "") then addadd__address2 = Request("address2")

Dim addadd__address3
addadd__address3 = ""
if(Request("address3") <> "") then addadd__address3 = Request("address3")

Dim addadd__address4
addadd__address4 = ""
if(Request("address4") <> "") then addadd__address4 = Request("address4")

Dim addadd__postcode
addadd__postcode = ""
if(Request("postcode") <> "") then addadd__postcode = Request("postcode")

Dim addadd__country
addadd__country = "UK"
if(Request("country") <> "") then addadd__country = Request("country")

%>
<%

set addadd = Server.CreateObject("ADODB.Command")
addadd.ActiveConnection = MM_Conn_STRING
addadd.CommandText = "dbo.insaddress"
addadd.Parameters.Append addadd.CreateParameter("@RETURN_VALUE", 3, 4)
addadd.Parameters.Append addadd.CreateParameter("@address1", 200, 1,50,addadd__address1)
addadd.Parameters.Append addadd.CreateParameter("@address2", 200, 1,50,addadd__address2)
addadd.Parameters.Append addadd.CreateParameter("@address3", 200, 1,50,addadd__address3)
addadd.Parameters.Append addadd.CreateParameter("@address4", 200, 1,50,addadd__address4)
addadd.Parameters.Append addadd.CreateParameter("@postcode", 200, 1,10,addadd__postcode)
addadd.Parameters.Append addadd.CreateParameter("@country", 200, 1,50,addadd__country)
addadd.Parameters.Append addadd.CreateParameter("@addid", 20, 2)
addadd.CommandType = 4
addadd.CommandTimeout = 0
addadd.Prepared = true
set myadd = addadd.Execute
myadd_numRows = 0

%>
<%

if(request.form("depotname") <> "") then insdep__dname = request.form("depotname")

if(myadd.fields.Item("addid").value) then insdep__myadd = myadd.fields.item("addid").value

%>
<%

set insdep = Server.CreateObject("ADODB.Command")
insdep.ActiveConnection = MM_Conn_STRING
insdep.CommandText = "INSERT INTO dbo.TBL_DEPOT (DEPOTNAME, ADDID) VALUES ( '" + Replace(insdep__dname, "'", "''") + "', " + Replace(insdep__myadd, "'", "''") + ") "
insdep.CommandType = 1
insdep.CommandTimeout = 0
insdep.Prepared = true
insdep.Execute()

%>


It doesnt find the item in the recordset

Any suggestions?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Getting my value from my stored proceedure


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT