Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ODP.Net Executing Proc

722332Sep 14 2009 — edited Sep 16 2009
In Visual Studio I am having some difficulty returning data to a grid from a stored proc using ODP.net. I am using an OracleDataAdapter to fill a DataTable which in turn is used as the DataSource.
I find that the first time I run the program ... the data is returned to the grid. If I then close the program ... then change the data and then run the program again ... the grid still displays the data as it was.
The altered datset is not displayed. Can someone pleased help me.



private OracleConnection conn = new OracleConnection();
private OracleCommand cmd = null;
private OracleDataAdapter adp = null;
private DataTable dt = null;


//I first set up the connection string
conn.ConnectionString = ..........

//create command using sql proc name
cmd = new OracleCommand("SPS_USERSTATUS", conn);
cmd.CommandType = CommandType.StoredProcedure;

//setup ref cursor
OracleParameter refCursor = new OracleParameter();
refCursor.OracleDbType = OracleDbType.RefCursor;
refCursor.Direction = ParameterDirection.Output;
cmd.Parameters.Add(refCursor);

adp = new OracleDataAdapter(cmd);
cmd.Prepare();
conn.Open();
cmd.ExecuteNonQuery();
dt = new DataTable();
adp.Fill(dt);
adp.Dispose();
dataGridView1.DataSource = dt;

Edited by: user8803094 on Sep 14, 2009 12:12 AM

Edited by: user8803094 on Sep 14, 2009 12:18 AM

Edited by: user8803094 on Sep 14, 2009 12:18 AM

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 14 2009
Added on Sep 14 2009
2 comments
3,290 views