Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 output parameters & asp.net

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2003-02-02 : 19:22:30

does anybody know where I can find some good articles on this? I haven't been able to find anything! .. I'm stuck on a problem, that I dont think is TOOO hard, it involves creating the SP, and the asp.net code to retrieve it.

THanks
Mike123

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2003-02-02 : 20:04:32
Mike,

No articles I know specifically talk about this issue.

A suggestion though...

If you are using a datareader (via ExecuteReader method) then it must be closed before you can read the output parameters..


DavidM

"SQL-3 is an abomination.."
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-02-03 : 01:18:39
I cant give you articles, but i can give thee code


Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As SqlCommand = New SqlCommand("mp_ProductUnitPrice", myConnection)

' Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure

' Add Parameters to SPROC
Dim prmProductID As SqlParameter = New SqlParameter("@ProductID", SqlDbType.Int, 4)
prmProductID.Value = productID
myCommand.Parameters.Add(prmProductID)

Dim prmUnitCost As SqlParameter = New SqlParameter("@UnitCost", SqlDbType.Money, 8)
prmUnitCost.Direction = ParameterDirection.Output
myCommand.Parameters.Add(prmUnitCost)

' Open the connection and execute the Command
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()


Helps?

OS

Go to Top of Page

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2003-02-03 : 01:25:52
perfect! thanks!

Go to Top of Page
   

- Advertisement -