|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Getting my value from my stored proceedure |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|