Click here to Skip to main content
14,869,589 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
string sql = "seect userName,Location,number where USER_ID=:id";

    OracleCommand cmd = new OracleCommand(sql, conn);
    cmd.BindByName = true;
    OracleParameter oparam = cmd.Parameters.Add("refcursor",OracleType.RefCursor);
    oparam.Direction = ParameterDirection.OutPut;
    cmd.Parameters.Add("id", userId);
    cmd.Connection.Open();
    cmd.ExecuteNonQuery();
    OracleDataAdapter adapter = new OracleDataAdapter(cmd);
    DataSet ds = new DataSet();
    adapter.Fill(ds);
return ds;


What I have tried:

I Have tried with this code but not getting data

C#
string sql = "seect userName,Location,number where USER_ID=:id";

    OracleCommand cmd = new OracleCommand(sql, conn);
    cmd.BindByName = true;
    OracleParameter oparam = cmd.Parameters.Add("refcursor",OracleType.RefCursor);
    oparam.Direction = ParameterDirection.OutPut;
    cmd.Parameters.Add("id", userId);
    cmd.Connection.Open();
    cmd.ExecuteNonQuery();
    OracleDataAdapter adapter = new OracleDataAdapter(cmd);
    DataSet ds = new DataSet();
    adapter.Fill(ds);
return ds;
Posted
Updated 19-Oct-20 22:00pm
v2
Comments
Sandeep Mewara 20-Oct-20 1:41am
   
What exactly are you trying to do here?
Herman<T>.Instance 20-Oct-20 4:15am
   
:0 in stead of :id ?
DGKumar 20-Oct-20 15:27pm
   
in the above code refcursor is not filling
j snooze 21-Oct-20 17:28pm
   
if this is truly your exact code make sure your SQL statement is syntactically correct. seect should be SELECT...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900