Je suis en train de modifier la routine suggérée par John here, en fait je ne l'ai pas changé quelque chose, je viens d'ajouter un paramètre, mais je reçoisASP classique format XML SQL Server avec procédure stockée et paramètres
ADODB.Command error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range,
or are in conflict with one another.
/test/test_xml.asp, line 19
où la ligne 19 contient:
ocmd.Parameters.Append paramTotals
J'ai essayé aussi d'une autre manière, comme
ocmd.Parameters("@ID").value=1030
mais je me l'erreur suivante:
Microsoft OLE DB Provider for SQL Server error '80040e21'
Procedure or function 'spTEST_XML' expects parameter '@ID', which was not supplied.
/test/test_xml.asp, line 20
où la ligne 20 il y a
oCmd.Execute , , 1025
While, if I remove the parameter it works perfectly....
ici la routine complète
Set oXML = Server.CreateObject("MSXML2.DomDocument.6.0")
Set oCmd = Server.CreateObject("ADODB.Command")
oCmd.ActiveConnection = "Provider=sqloledb;server=TEST;Database=test;User ID=sa;Password=test"
oCmd.Properties("Output Stream") = oXML
oXml.async = false
oCmd.CommandText = "spTEST_XML"
ocmd.CommandType=4
Set paramTotals = ocmd.CreateParameter("@ID", adInteger, adParamInput, , 1030)
ocmd.Parameters.Append paramTotals
oCmd.Execute , , 1025
Response.ContentType="text/xml"
Response.Write("<?xml version='1.0' encoding='utf-8'?>")
Response.Write oXML.xml
Set oXML = Nothing
Set oCmd = Nothing
alors qu'ici le haut de la StoredProcedure
CREATE PROCEDURE [dbo].[spTEST_XML]
(
@ID int
)
AS
BEGIN
Declare @SDT datetime = sysdatetime()
if @ID is null
begin
update dbo.PayPal set [email protected] where Validation='VERIFIED' AND downloaded is null
end
else
begin
update dbo.PayPal set [email protected] where Validation='VERIFIED' AND ID>[email protected]
end
select
payment.id reference_id,
payment.SMSRN SellingManagerSalesRecordNumber,
cast(dateadd(hh,2,payment.payment_date) as date) payment_date_CET,
payment.receiver_email,
payment.auction_buyer_id,
payment.payer_email,
format(payment.mc_gross/XC,'N2') Payment_EUR,
format(payment.mc_fee/XC,'N2') Fees_EUR,
format((payment.mc_gross-payment.mc_fee)/xc,'N2') Net_EUR,
format(payment.mc_handling/xc,'N2') Handling_EUR,
format(payment.mc_shipping/xc,'N2') Shipping_EUR,
payment.payment_status,
payment.num_cart_items,
payment.memo,
payment.case_id,
payment.mc_currency,
payment.mc_gross,
payment.mc_fee,
payment.mc_handling,
payment.mc_shipping,
payment.payment_date
from
(
select distinct
p.id,p.payment_date, p.auction_buyer_id, p.mc_currency, p.mc_gross, p.mc_fee, p.payer_email, p.receiver_email, s.sellingmanagersalesrecordnumber SMSRN,
coalesce(p.mc_handling,0) mc_handling, p.mc_shipping, p.payment_status,
p.num_cart_items, p.memo, p.case_id, p.case_type, p.case_creation_date,
p.case_closed,
coalesce(CAST ((Select top (1) rate from dbo.EurRates r where r.Currency=p.mc_currency and r.FXDate<=p.payment_date) as Decimal (10,4)),1) XC
from dbo.PayPal p
left join dbo.eBaySales s on s.referenceID=p.txn_id
where p.Validation='VERIFIED'
and [email protected]
) as Payment
order by receiver_email asc, payment_date desc
FOR XML AUTO , ROOT ('PaymentsArray') , ELEMENTS
FIN
'Alors que, si je supprime le paramètre, il fonctionne parfaitement ....' Quelle est la question alors? –
si je supprime les 2 lignes avec 'Set paramTotals = ocmd.CreateParameter (" @ ID ", adInteger, adParamInput,, 1030) ocmd.Parameters.Append paramTotals' la routine fonctionne, mais j'ai besoin d'ajouter un paramètre à la procédure , mais j'ai eu cette erreur et je ne comprends pas pourquoi: mes connaissances sont basiques mais ce n'est pas la première procédure stockée que je construis, bien que ce soit la première avec 'for for xml' en sortie. – Joe
avez-vous des définitions pour la constante ADO AdInteger? Cela peut généralement être trouvé dans un fichier include adovbs.inc. –