[Info-ingres] Calling Ingres Database Procedures through .Net Data Provider

DATABASE

    Sponsored Links

    Next

  • 1. Private/Public access to DBMS
    All, is it possible to mark the DBMS servers for Public/Private access Greg Gregory Wilding UK North Midlands Solutions Centre Abney Park Manchester Road Cheadle Cheshire SK8 2PD Tel +44 (0) 161 495 3488 Fax +44(0) 161 428 5009 <mailto: XXXX@XXXXX.COM <mailto: XXXX@XXXXX.COM > >
  • 2. Report Generator for CA-Ingres / G erador de relat髍ios para CA-Ingres
    Does some one know if exists a Report Generator(RG) for CA-Ingres? I know that exists Report Writer, Visual Express and others. But, I'm looking for a RG to "end users", a RG that users can made our own reports. Tks Fabrio Dhein

[Info-ingres] RE: Calling Ingres Database Procedures through .Net Data Provider

Postby Thole, David J » Fri, 17 Jun 2005 02:34:55 GMT

his is a multi-part message in MIME format.

Ingres r3 supports row-producing procedures. The Ingres .NET Data
Provider reads the result set produced by that procedure just as any
result set produced by a query.



If the procedure is something like this:



drop procedure rowproc \p\g



create procedure rowproc

result row(char(32)) as

declare tabname char(32);

begin

for select table_name into :tabname from iitables

do

return row(:tabname);

endfor;

end;

\p\g



The .NET application would execute the procedure and read the result set
like this:



IDataReader reader = null;

cmd = new IngresCommand(

"rowproc", conn, txn); //"{ call rowproc}", conn, txn);

cmd.CommandType = CommandType.StoredProcedure;

reader = cmd.ExecuteReader();



Console.Write("ColumnName='" + reader.GetName(0) + "'");

Console.WriteLine();



while (reader.Read())

{

Console.Write(reader.GetString(0) + "\t");

}

Console.WriteLine();

reader.Close();



Hope this helps,

Dave


<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:#606420;
text-decoration:underline;}
span.EmailStyle17
{font-family:Arial;
color:windowtext;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink="#606420">

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Ingres r3 supports row-producing procedures.  The
Ingres .NET Data Provider reads the result set produced by that procedure just
as any result set produced by a query.</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>If the procedure is something like this:</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>drop procedure rowproc \p\g</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>create procedure rowproc</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><spa

Similar Threads:

1.[Info-ingres] Calling Ingres Database Procedures through .Net Data Provider

2.Calling Ingres Database Procedures through .Net Data Provider

Thole, David J wrote:
> Ingres r3 supports row-producing procedures.  The Ingres .NET Data 
> Provider reads the result set produced by that procedure just as any 
> result set produced by a query.
> 
>  
> 
> If the procedure is something like this:
> 
>  
> 
> drop procedure rowproc \p\g
> 
>  
> 
> create procedure rowproc
> 
>    result row(char(32)) as
> 
> declare tabname char(32);
> 
> begin
> 
>    for select table_name into :tabname from iitables
> 
>    do
> 
>       return row(:tabname);
> 
>    endfor;
> 
> end;
> 
> \p\g
> 
>  
> 
> The .NET application would execute the procedure and read the result set 
> like this:
> 
>  
> 
>             IDataReader reader = null;
> 
>       cmd = new IngresCommand(
> 
>             "rowproc", conn, txn); //"{ call rowproc}", conn, txn);
> 
>       cmd.CommandType = CommandType.StoredProcedure;
> 
>       reader = cmd.ExecuteReader();
> 
>  
> 
>       Console.Write("ColumnName='" + reader.GetName(0) + "'");
> 
>       Console.WriteLine();
> 
>  
> 
>       while (reader.Read())
> 
>       {
> 
>             Console.Write(reader.GetString(0) + "\t");
> 
>       }
> 
>       Console.WriteLine();
> 
>       reader.Close();
> 
>  
> 
> Hope this helps,
> 
> Dave
> 

That's almost what I'm looking for too.  I need to return data from a 
stored procedure in a way that it is accepted with open arms into a 
DataSet.

I'm also wondering which method is better practice when calling a stored 
procedure - specifying the parameters using the provided classes lie this :

IngresCommand iCmd = new IngresCommand("usr_add", iConn);
         iCmd.CommandType = CommandType.StoredProcedure;

         IngresParameter parm1 = new 
IngresParameter("in_username",IngresType.NVarChar,45);
         IngresParameter parm2 = new 
IngresParameter("in_password",IngresType.NVarChar,45);

         parm1.Value = usrName;
         parm2.Value = pwd;

         parm1.Direction = ParameterDirection.Input;
         parm2.Direction = ParameterDirection.Input;

         iCmd.Parameters.Add(parm1);
         iCmd.Parameters.Add(parm2);

         try
         {
             int numRows = iCmd.ExecuteNonQuery();
             return true;
         }

or just embedding the parameters in the command string itself :

         string iCmdText = @"execute procedure usr_delete 
(in_username='" + usrName + @"', in_password='" + pwd @"')";
         IngresCommand iCmd = new IngresCommand(iCmdText, iConn);

where usrName and pwd are strings...

Morgan.

3.[Info-Ingres] Ingres .Net data provider and VS 2005 Data Sources

4.[Info-Ingres] Ingres .NET data provider

5.[Info-Ingres] .NET Data Provider with Ingres 2.6

6. [Info-ingres] Visual Studio and Ingres .Net Providers

7. [Info-ingres] returning a single value from a database procedure in .NET

8. [Info-ingres] OpenAPI Calling a database procedure



Return to DATABASE

 

Who is online

Users browsing this forum: No registered users and 27 guest