I am trying to execute a stored procedure in ASE 15.7 using
Visual Studio’s Entity Framework. It has one string input
parameter and one string output parameter. Here is the C#
code:

ObjectParameter parm2 = new
ObjectParameter("nextno_value", typeof(string));
entities.gp_test("bat_no", parm2);

where ‘entities’ is the context for the entities model
which includes the stored procedure ‘gp_test’.

An exception occurs “An external component has thrown an
exception” which yields the following stack trace:

at Sybase.Data.AseClient.Unmanaged.BindParameter(IntPtr
pCommandHandle, String paramName, AseDbType sqlType, Int32
precision, Int32 scale, String value, ParameterDirection
direction, Int32 size, Int32 isNull)
at Sybase.Data.AseClient1.AseCommand.BindParameters()
at Sybase.Data.AseClient1.AseCommand.Execute(CommandBehavior
commandBehavior)
at
Sybase.Data.AseClient1.AseCommand._ExecuteReader(CommandBehavior
commandBehavior)
at
Sybase.Data.AseClient1.AseCommand.ExecuteReader(CommandBehavior
commandBehavior)
at
Sybase.Data.AseClient.AseCommand.ExecuteDbDataReader(CommandBehavior
behavior)
at
System.Data.Common.DbCommand.ExecuteReader(CommandBehavior
behavior)
at
System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand
entityCommand, CommandBehavior behavior)" string

The definition of the stored procedure is as follows:

create proc gp_test
@nextno_field varchar(10),
@nextno_value varchar(10) output
as
begin
select @nextno_value = "123456"
--select @nextno_value
--return(1)
end

Where the commented out lines are just things I tried to see
if they would resolve the issue. The stored procedure was
first added to the model, then imported with Function Import
and specified that it returns a collection of “none”.

All these variants also return the same error:

var result = entities.gp_test("dontcare", parm2);

var result = entities.gp_testCollection("dontcare",
parm2).First<string>();
(here I just did another Function Import on the same stored
procedure but as returning a collection of strings).

Note that LINQ queries work great against ‘entities’, I
can both select from and update/insert into Sybase just
fine. Only stored procedures are problematic.