on 2013 Aug 16 2:17 AM
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) myConnection.Open(); 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; myCmd.Parameters.Add(parm1); 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; myCmd.Parameters.Add(parm2); 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; myCmd.Parameters.Add(parm3); ... object o = myCmd.ExecuteScalar();// I got null here, why? /* however in isql begin 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; end 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. */
Request clarification before answering.
Try select from dba.get_AcctInfo instead of call dba.get_AcctInfo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
60 | |
10 | |
8 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.