<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Working with AS400-iSeries-System i Stored Procedures in .NET</title>
	<atom:link href="http://www.developingfor.net/as400/working-with-as400-iseries-system-i-stored-procedures-in-net.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.developingfor.net/as400/working-with-as400-iseries-system-i-stored-procedures-in-net.html</link>
	<description>Real World .NET Methods, Tricks, and Examples</description>
	<lastBuildDate>Fri, 30 Jul 2010 16:13:40 -0400</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Joel</title>
		<link>http://www.developingfor.net/as400/working-with-as400-iseries-system-i-stored-procedures-in-net.html/comment-page-1#comment-10113</link>
		<dc:creator>Joel</dc:creator>
		<pubDate>Wed, 28 Jul 2010 20:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.developingfor.net/as400/working-with-as400-iseries-system-i-stored-procedures-in-net.html#comment-10113</guid>
		<description>1) The error message indicates the problem is with the parameter direction.  In your code, you are chaining the direction to the Parameters.Add() method.  I would try creating the Parameter object and then applying the Direction, like in the example above:

_cmd.Parameters[name].Direction = direction;

2) I refuse to use the ODBC driver for the AS/400, it has caused me nothing but grief every time I&#039;ve tried it. If you have that driver, you should also have the OLE/DB driver, and if I have to pick between the two I would recommend OLE/DB.

3) You are using CALL on the CommandText property and trying to send the parameter there -
cmd.CommandText = “CALL CMSFIL.SPCONCUR(’0′)”;

When I do SPROCs against the 400, I ONLY specify the qualified procedure name:
cmd.CommandText = “CMSFIL.SPCONCUR”;

The provider should do the rest of the work.

I hope this helps.</description>
		<content:encoded><![CDATA[<p>1) The error message indicates the problem is with the parameter direction.  In your code, you are chaining the direction to the Parameters.Add() method.  I would try creating the Parameter object and then applying the Direction, like in the example above:</p>
<p>_cmd.Parameters[name].Direction = direction;</p>
<p>2) I refuse to use the ODBC driver for the AS/400, it has caused me nothing but grief every time I&#8217;ve tried it. If you have that driver, you should also have the OLE/DB driver, and if I have to pick between the two I would recommend OLE/DB.</p>
<p>3) You are using CALL on the CommandText property and trying to send the parameter there -<br />
cmd.CommandText = “CALL CMSFIL.SPCONCUR(’0′)”;</p>
<p>When I do SPROCs against the 400, I ONLY specify the qualified procedure name:<br />
cmd.CommandText = “CMSFIL.SPCONCUR”;</p>
<p>The provider should do the rest of the work.</p>
<p>I hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dotnet</title>
		<link>http://www.developingfor.net/as400/working-with-as400-iseries-system-i-stored-procedures-in-net.html/comment-page-1#comment-10111</link>
		<dc:creator>dotnet</dc:creator>
		<pubDate>Wed, 28 Jul 2010 17:38:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.developingfor.net/as400/working-with-as400-iseries-system-i-stored-procedures-in-net.html#comment-10111</guid>
		<description>Hi,

I am using a ODBC connection for executing the storedprocedure on as400.

I am getting the error,

connected to the datasource

System.Data.Odbc.OdbcException: ERROR [HY000] [IBM][iSeries Access ODBC Driver][
DB2 UDB]SQL0469 - IN, OUT, or INOUT not valid for parameter 1 in procedure SPCON
CUR in CMSFIL.
   at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode r
etcode)
   at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior,
 String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMet
hod)
   at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior,
 String method, Boolean needReader)
   at System.Data.Odbc.OdbcCommand.ExecuteNonQuery()
   at SPConcuri.Program.Main(String[] args) in 

Here is part of my code,

 conn = new OdbcConnection(constr);
                conn.Open();
                System.Threading.Thread.Sleep(20000);
                Console.WriteLine(&quot;connected to the datasource&quot;);
                OdbcCommand cmd = new OdbcCommand();
                cmd.CommandText = &quot;CALL CMSFIL.SPCONCUR(&#039;0&#039;)&quot;;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection = conn;

                cmd.Parameters.Add(&quot;@RSLT&quot;, OdbcType.Char, 1).Direction = ParameterDirection.InputOutput;
                cmd.Parameters[&quot;@RSLT&quot;].Value = &quot;0&quot;;</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am using a ODBC connection for executing the storedprocedure on as400.</p>
<p>I am getting the error,</p>
<p>connected to the datasource</p>
<p>System.Data.Odbc.OdbcException: ERROR [HY000] [IBM][iSeries Access ODBC Driver][<br />
DB2 UDB]SQL0469 &#8211; IN, OUT, or INOUT not valid for parameter 1 in procedure SPCON<br />
CUR in CMSFIL.<br />
   at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode r<br />
etcode)<br />
   at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior,<br />
 String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMet<br />
hod)<br />
   at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior,<br />
 String method, Boolean needReader)<br />
   at System.Data.Odbc.OdbcCommand.ExecuteNonQuery()<br />
   at SPConcuri.Program.Main(String[] args) in </p>
<p>Here is part of my code,</p>
<p> conn = new OdbcConnection(constr);<br />
                conn.Open();<br />
                System.Threading.Thread.Sleep(20000);<br />
                Console.WriteLine(&#8220;connected to the datasource&#8221;);<br />
                OdbcCommand cmd = new OdbcCommand();<br />
                cmd.CommandText = &#8220;CALL CMSFIL.SPCONCUR(&#8217;0&#8242;)&#8221;;<br />
                cmd.CommandType = CommandType.StoredProcedure;<br />
                cmd.Connection = conn;</p>
<p>                cmd.Parameters.Add(&#8220;@RSLT&#8221;, OdbcType.Char, 1).Direction = ParameterDirection.InputOutput;<br />
                cmd.Parameters["@RSLT"].Value = &#8220;0&#8243;;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dew Drop &#8211; October 27, 2009 &#124; Alvin Ashcraft&#39;s Morning Dew</title>
		<link>http://www.developingfor.net/as400/working-with-as400-iseries-system-i-stored-procedures-in-net.html/comment-page-1#comment-9904</link>
		<dc:creator>Dew Drop &#8211; October 27, 2009 &#124; Alvin Ashcraft&#39;s Morning Dew</dc:creator>
		<pubDate>Tue, 27 Oct 2009 13:06:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.developingfor.net/as400/working-with-as400-iseries-system-i-stored-procedures-in-net.html#comment-9904</guid>
		<description>[...] Working with AS400-iSeries-System i Stored Procedures in .NET (Joel Cochran) [...]</description>
		<content:encoded><![CDATA[<p>[...] Working with AS400-iSeries-System i Stored Procedures in .NET (Joel Cochran) [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
