return parameters for stored procedures with sql server 7 using odbc
| From: | Ian Ferger | Date: | Wed, 12 Dec 2001 20:01:44 +0000 |
| Subject: | return parameters for stored procedures with sql server 7 using odbc | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14975@lists.php.net to get a copy of this message | ||
i am converting an existing asp site over to php (noble cause) and i am
using odbc as my connection layer. i have no problem with statements, but
difficulties with stored procs.
the following is one of the statements i am trying to convert:
<pre>
Set cmdSub = Server.CreateObject("ADODB.Command")
With cmdSub
.ActiveConnection = DBConn
.CommandText = "sp_edit_UtilCorp"
.CommandType = 4 ' - adCmdStoredProc
.Parameters("@UTILCORP_ID") = UTILCORP_ID
.Parameters("@CoName") = CoName
.Parameters("@Add1") = Add1
.Parameters("@Add2") = Add2
.Parameters("@City") = City
.Parameters("@State") = State
.Parameters("@Zip") = Zip
.Parameters("@Tel") = Tel
.Parameters("@Fax") = Fax
.Parameters("@Email") = Email
.Parameters("@ContactName") = ContactName
.Execute
edit_status = .Parameters("@RETURN_VALUE")
End With
</pre>
i found this under odbc_execute, but it supposedly is unable to give a
return value:
<pre>
$stmt=odbc_prepare($conn_id, "exec my_proc_name ?,?,?");
$parms=array("fred","password",5);
if (!odbc_execute($stmt, &$parms)) die("odbc_execute failed");
</pre>
is it possible to change this to both: explicitly pass the parameters by
name and pass the return value to a variable?????
thx
Ian Ferger