View Single Post
  #3 (permalink)  
Old 10-10-2008, 2:59 PM
JaedenRuiner's Avatar
JaedenRuiner JaedenRuiner is offline
VB.NET Forum Master
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Aug 2007
Age: 30
Posts: 310
Reputation: 67
JaedenRuiner probably authored a book by nowJaedenRuiner probably authored a book by nowJaedenRuiner probably authored a book by now
Default

Quote:
Originally Posted by ss7thirty View Post
You can just make this an OUTPUT variable. There is a property of SQLParameter object and I think it is called direction and it is an enum with three values. Input, Output, Both. Google this 'T-SQL Stored Proc Output Parameters VB.NET' that should get the job done.

Yea,

I found that via Google about 30 seconds after posting this question. Procs only return ints, where Functions can return whatever type you want. As a matter of curiosity, when I set up the command via the DataSource Designer (for Strongly Typed Datasets) it did something interesting. In the SQL Manager where I created the Procedure, I set the OUTPUT parameter to OUTPUT. However, VB Express interpreted that as an InputOutput parameter which proceeded to complain when I tried to execute the SqlCommand like this: (Output Parameter is Parameter(3))
[code]
cmd.Parameters(1).value = CustID
cmd.Parameters(2).value = -1
try
cmd.ExecuteNonQuery()
catch
end try
[code]

I fixed it by simply adding the line:
Code:
cmd.parameters(3).Value = ""
My Curiosity is whether the InputOutput determined type of that Parameter is that VB's doing or is that necessary for the interface with the Stored Proc on the DB, or can i manually (through the designer) change that parameter to Output Only and then eliminate that parameter initializer in my code?

Thanks
__________________
Jaeden "Sifo Dyas" al'Raec Ruiner
http://www.wayoftheleaf.net/
Reply With Quote