pasylo
Messages postés1Date d'inscriptionjeudi 26 décembre 2002StatutMembreDernière intervention22 octobre 2004
-
22 oct. 2004 à 09:53
cs_fabrice69
Messages postés1765Date d'inscriptionjeudi 12 octobre 2000StatutMembreDernière intervention11 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()
%>
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
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