× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 8/29/07, Joel Cochran <joelcochran@xxxxxxxxx> wrote:
CREATE PROCEDURE GetCusName()

RESULT SETS 1
LANGUAGE SQL
BEGIN
DECLARE c1 CURSOR WITH RETURN FOR
SELECT cusnam FROM customer ORDER BY cusnam;
OPEN c1;
END


Does anyone have an example of consuming this in .NET? Is it a DataSet or a
IDataReader?

I use the Odbc classes. The sql procedure result set is read as rows
thru the OdbcDataReader class.

OdbcConnection conn = new OdbcConnection( strConn ) ;
OdbcCommand cmd = conn.CreateCommand();
cmd.CommandText = "CALL librayr.ProcedureName(?)";

OdbcParameter parm1 = new OdbcParameter("@SpeedNum", OdbcType.Char, 14);
parm1.Value = "KUE275";
cmd.Parameters.Add(parm1);

OdbcDataReader reader = cmd.ExecuteReader();

while (reader.Read())
{
string name = reader.GetString(0);
string order_num = reader.GetString(2);
string[] row = new string[2];
row[0] = name;
row[1] = order_num;
tbl.Rows.Add(row);
}
reader.Close();


.net is by far the best way to write interactive applications for the as400.

-Steve

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.