The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

the stored procedure has been executed from isql successfully and returns proper value and @@rowcount correctly; SAConnection myConnection = ModuleDb.myConnection;

SACommand myCmd = new SACommand("dba.get_AcctInfo", myConnection);
myCmd.CommandType = System.Data.CommandType.StoredProcedure;

if (myConnection.State.CompareTo(ConnectionState.Broken) == 0 |
myConnection.State.CompareTo(ConnectionState.Closed) == 0)

SAParameter parm1 = new SAParameter("@WebAcctShortName", SADbType.VarChar);
parm1.Precision = 0;
parm1.Scale = 0;
parm1.Size = 24;
parm1.Direction = ParameterDirection.Input;
parm1.IsNullable = false;
parm1.SourceColumnNullMapping = false;
parm1.Value = WebAcctShortName;

SAParameter parm2 = new SAParameter("@acct_ID", SADbType.Integer);
parm2.Precision = 0;
parm2.Scale = 0;
parm2.Size = 4;
parm2.Direction = ParameterDirection.Output;
parm2.IsNullable = false;
parm2.SourceColumnNullMapping = false;

SAParameter parm3 = new SAParameter("@AcctTyp", SADbType.VarChar);
parm3.Precision = 0;
parm3.Scale = 0;
parm3.Size = 1;
parm3.Direction = ParameterDirection.Output;
parm3.IsNullable = false;
parm3.SourceColumnNullMapping = false;
object o = myCmd.ExecuteScalar();// I got null here, why?
    however in isql
declare rc int;
declare @WebAcctShortName varchar(24);
declare @coCode varchar(10);
declare @acct_ID integer;
declare @AcctTyp varchar(1);
declare @acctGrpId integer;
declare @acct_alias varchar(16);
declare @acctNicknm varchar(28);
set "@webAcctNbr" = '68622424'; set"@WebAcctShortName" = 'INVEST';
set"@coCode" = null;
rc= CALL "dba"."get_AcctInfo" ("@webAcctNbr","@WebAcctShortName","@coCode", @acct_ID,
 @AcctTyp, @acctGrpId,@acct_alias, @acctNicknm);// into rc;
select rc, @acct_ID, @AcctTyp, @acctGrpId,@acct_alias, @acctNicknm;
yield all proper values
what did I go wrong in my C# code?
the c# app is .net 3.5, from visual studio 2008 standard
actually the code was generated from a template that I was able to use successfully many times.

asked 16 Aug '13, 01:17

gg99's gravatar image

accept rate: 0%

edited 16 Aug '13, 01:24

How do you specify the parameter for the SP's return value (i.e. the parameter that will hold what the variable rc receives in the DBISQL call)?

(20 Aug '13, 04:20) Volker Barth

Try select from dba.get_AcctInfo instead of call dba.get_AcctInfo

permanent link

answered 19 Aug '13, 05:07

Martin's gravatar image

accept rate: 14%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 16 Aug '13, 01:17

question was seen: 954 times

last updated: 20 Aug '13, 04:20