Procédure stockée + ASP + Dreamweaver

pasylo Messages postés 1 Date d'inscription jeudi 26 décembre 2002 Statut Membre Dernière intervention 22 octobre 2004 - 22 oct. 2004 à 09:53
cs_fabrice69 Messages postés 1765 Date d'inscription jeudi 12 octobre 2000 Statut Membre Dernière intervention 11 décembre 2013 - 29 oct. 2004 à 10:07
Bonjour tout le monde,

Je travail en ASP sous Dreamweaver, j'ai une base SQL 2000. Je voudrait savoir si il est possible de faire apparaitre le résultat des procédures stockées créées par SQL dans une page ASP avec Dreamweaver.
J'ai utilisé la fonction "Liaisons + commande (procédure stockée)" j'ai été pointer sur la procédure stockée dans ma base SQL, validé le tout. lors de l'éxécution de ma page il me met:
Type d'erreur :
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
[Microsoft][ODBC SQL Server Driver]Fonctionnalité optionnelle non implémentée
/helpweb_2004/gr_dcf/index_rep_fr_dcf.asp, line 20

J'ai cherché dans tous les sens, et je ne trouve pas. Voici mon code:
<%
Dim Command1__ID_Pays
Command1__ID_Pays = "1"
if(Request("IDPays") <> "") then Command1__ID_Pays = Request("IDPays")
%>
<%
12 set Command1 = Server.CreateObject("ADODB.Command")
13 Command1.ActiveConnection = MM_MILBORNES_STRING
14 Command1.CommandText = "exec dbo.1000B-reporting Pays"
15 Command1.Parameters.Append Command1.CreateParameter("@RETURN_VALUE", 3, 4)
16 Command1.Parameters.Append Command1.CreateParameter("@ID_Pays", 20, 1,8,Command1__ID_Pays)
17 Command1.CommandType = 4
18 Command1.CommandTimeout = 0
19 Command1.Prepared = false
20 Command1.Execute()
%>

Merci de m'avoir lu et merci de vos réponse

A+

1 réponse

cs_fabrice69 Messages postés 1765 Date d'inscription jeudi 12 octobre 2000 Statut Membre Dernière intervention 11 décembre 2013 5
29 oct. 2004 à 10:07
Regarde déja ici :
- http://www.asp-php.net/tutorial/asp-php/proc_stockee.php

Via google tu as aussi ca :
- http://www.google.fr/search?q=cache:fkoeBEa3KZYJ:support.microsoft.com/support/kb/articles/Q164/4/85.asp+ASP+execute+stored+procedures&hl=fr

avec l'exemple ci dessous :

--------
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include virtual="/ASPSAMP/SAMPLES/ADOVBS.INC"-->
<HTML>
<HEAD><TITLE>Place Document Title Here</TITLE></HEAD>

This first method queries the data source about the parameters
of the stored procedure. This is the least efficient method of calling
a stored procedure.

<%
Set cn = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
cn.Open "data source name", "userid", "password"
Set cmd.ActiveConnection = cn
cmd.CommandText = "sp_test"
cmd.CommandType = adCmdStoredProc
' Ask the server about the parameters for the stored proc
cmd.Parameters.Refresh
' Assign a value to the 2nd parameter.
' Index of 0 represents first parameter.
cmd.Parameters(1) = 11
cmd.Execute
%>
Calling via method 1

ReturnValue = <% Response.Write cmd.Parameters(0) %>

<!-- ************************************************************ -->

Method 2 declares the stored procedure, and then explicitly declares
the parameters.

<%
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "data source name", "userid", "password"
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = cn
cmd.CommandText = "sp_test"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("RetVal", adInteger, _
adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, _
adParamInput)
' Set value of Param1 of the default collection to 22
cmd("Param1") = 22
cmd.Execute
%>
Calling via method 2

ReturnValue = <% Response.Write cmd(0) %>

<!-- ************************************************************ -->

Method 3 is probably the most formal way of calling a stored procedure.
It uses the canocial
<%
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "data source name", "userid", "password"
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = cn
' Define the stored procedure's inputs and outputs
' Question marks act as placeholders for each parameter for the
' stored procedure
cmd.CommandText = "{?=call sp_test(?)}"
' specify parameter info 1 by 1 in the order of the question marks
' specified when we defined the stored procedure
cmd.Parameters.Append cmd.CreateParameter("RetVal", adInteger, _
adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, _
adParamInput)
cmd.Parameters("Param1") = 33
cmd.Execute
%>
Calling via method 3

ReturnValue = <% Response.Write cmd("RetVal") %>

</HTML>
-------

Romelard Fabrice (Alias F___)
0
Rejoignez-nous