Unix Technical Forum

Re: problems with output parameters with Ole Db provider for ASE 12.5

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 ...


Go Back   Unix Technical Forum > Database Server Software > Sybase

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 03:52 PM
m_w_gibson
 
Posts: n/a
Default Re: problems with output parameters with Ole Db provider for ASE 12.5


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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com