This is a discussion on Re: problems with output parameters with Ole Db provider for ASE 12.5 within the Sybase forums, part of the Database Server Software category; --> Lucap, Did you ever get any responses to this? Have you fixed it? I came across the same thing ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Lucap, Did you ever get any responses to this? Have you fixed it? I came across the same thing some time ago and had to do some ugly hacks to work around it. I'm now at the point where I don't think any ugly hacks are going to hack it, and I need the output parameter functionality desparately. Mark Originally posted by Lucap > Hi, I'm using .NET to access an ASE 12.5 server using the OleDB > provider > that comes with the ASE client 12.5 installation. > > Till now I didn't have any problems with stored procedure with input > parameters only. > > I'm facing big problems whenever I call a stored procedure with > an output > parameter... here is the procedure (a very simple sp on a Northwind- > like db > on Sybase) > > CREATE PROCEDURE CUSTCONTACT > @CustomerID char(5), > @ContactName varchar(30) OUTPUT, > @ContactTitle varchar(30) OUTPUT > AS > > SELECT @ContactName = ContactName, > @ContactTitle = ContactTitle > FROM Customers > WHERE CustomerID = @CustomerID > > the problem is that I can't get the right values from the two output > parameters after the call of the procedure. Here is the code which > I execute > the sp with: > > // sp CUSTCONTACT > OleDbCommand cmd = new OleDbCommand("CUSTCONTACT", oleDbConn); > cmd.CommandType = CommandType.StoredProcedure; > > OleDbParameter id = new OleDbParameter(); > id.Direction = ParameterDirection.Input; > id.OleDbType = OleDbType.Char; > id.Size = 5; > id.Value = "ANTON"; > id.ParameterName = "@CustomerID"; > cmd.Parameters.Add(id); > > OleDbParameter name = new OleDbParameter(); > name.Direction = ParameterDirection.Output; > name.OleDbType = OleDbType.VarChar; > name.Size = 30; > name.ParameterName = "@ContactName"; > cmd.Parameters.Add(name); > > OleDbParameter title = new OleDbParameter(); > title.Direction = ParameterDirection.Output; > title.OleDbType = OleDbType.VarChar; > title.Size = 30; > title.ParameterName = "@ContactTitle"; > cmd.Parameters.Add(title); > > int r = cmd.ExecuteNonQuery(); > > object n = cmd.Parameters["@ContactName"].Value.ToString(); > object t = cmd.Parameters["@ContactTitle"].Value.ToString(); > > > the results are: no errors after the ExecuteNonQuery, -1 rows > affected ... > but n="Owner" and t="", the strange result is that n should be > tha name > "Antonio Moreno" while t should be "Owner" which is the value > returned by n > istead! > > Is there anyone with an idea of what is going on.... I'm new to > Sybase, > maybe it's a well known bug.... > > Thank you very much > Lucap -- Posted via http://dbforums.com |