|
| Re: Oracle procedure , oracle datareader |
 |
Tue, 18 Mar 2008 13:07:38 +000 |
Natarajan Manoharan:
Hi ,
i had written the stored procedure for to reterive the rows values with some
condition,and it is working fine.
from .net code i am sending the condition values and executing by using the
command,
OracleDataReader reader=null;
---
reader=cmd.ExecuteReader(CommandBehaviour.SingleRow);
the problem is reader doesn't fetching the values the property of the
reader.HasRows comes false after excution.
Have you set the command text and command type properly fro your OracleCommand
object named cmd?
cmd.CommandText="StoredProcedureName";
cmd.CommandType=CommandType.StoredProcedure;
--------------------------------------------------------------------------------
---------------------------------------------------------------
Please mark as Answer if this helped in solving your problem.
|
| Post Reply
|
| Oracle procedure , oracle datareader |
 |
Tue, 18 Mar 2008 14:16:00 +000 |
Hi ,
i had written the stored procedure for to reterive the rows values with some
condition,and it is working fine.
from .net code i am sending the condition values and executing by using the
command,
OracleDataReader reader=null;
---
reader=cmd.ExecuteReader(CommandBehaviour.SingleRow);
the problem is reader doesn't fetching the values the property of the
reader.HasRows comes false after excution.
|
| Post Reply
|
| Re: Oracle procedure , oracle datareader |
 |
Tue, 18 Mar 2008 15:20:59 +000 |
can u post the code.
did u placed reader.read();
did u specified the properties commandtext,commandtype and connection.
if parameters are defined in procedure, parameters are defined in program r not?
if u want to retrieve instead of executedatareader u can use executescalar.
plz correct me if i m wrong.
|
| Post Reply
|
| Re: Oracle procedure , oracle datareader |
 |
Wed, 19 Mar 2008 10:41:13 +000 |
Code goes here .....OracleConnection conn =
newOracleConnection(connectionString);
OracleCommand cmd = null;OracleDataReader reader = null;
cmd = newOracleCommand("GetItem", conn);cmd.CommandType =
CommandType.StoredProcedure;
cmd.Parameters.Add(newOracleParameter("Expire_Date",
OracleType.DateTime));cmd.Parameters["Expire_Date"].Direction =
ParameterDirection.Output;
cmd.Parameters.Add(newOracleParameter("Items",
OracleType.Clob));cmd.Parameters["Items"].Direction =
ParameterDirection.Output;
cmd.Parameters.Add(newOracleParameter("Id", OracleType.VarChar,
80));cmd.Parameters["Id"].Direction = ParameterDirection.Input;
cmd.Parameters["Id"].Value =
id;cmd.Parameters.Add(newOracleParameter("AppName",
OracleType.VarChar, 255));
cmd.Parameters["AppName"].Direction = ParameterDirection.Input;
cmd.Parameters["AppName"].Value = ApplicationName;reader =
cmd.ExecuteReader(CommandBehavior.SingleRow);while (reader.Read())
{
expires = reader.GetDateTime(0);
serializedItems = reader.GetString(1);
}
reader.Close();
reader = cmd.ExecuteReader(CommandBehavior.SingleRow); this line is executing
well but reader.Read() loop is throws an exception,hence reader.HasRows is false
and my stored procedure is executing well.
|
| Post Reply
|
| Re: Oracle procedure , oracle datareader |
 |
Wed, 19 Mar 2008 11:50:07 +000 |
Where is conn.open(). U have to open the connection na. This is one mistake i
traced. Plz check that still if u get the errors post the error message.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|