Skip to Main Content

ODP.NET

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!

OraDataReader / ASP.Net

312797Jul 26 2002
Is there any reason why I can't bind an OraDataReader to a DataGrid control like I could with a SqlDataReader? I'm receiving a "Specified method is not supported" error message when trying to do so. Not supported? Why?

Code snippet:

protected System.Web.UI.WebControls.DataGrid paymentMethodGrid;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here

OraConnection oraConnection = new OraConnection(ConfigurationSettings.AppSettings.Get("connectionString"));
OraCommand oraCommand = new OraCommand("pkg_css_session_state.prc_payment_method", oraConnection);
oraCommand.CommandType = CommandType.StoredProcedure;

oraCommand.Parameters.Add("my_ref_cursor", OraDbType.RefCursor, DBNull.Value, ParameterDirection.Output);

try
{
oraConnection.Open();
oraCommand.ExecuteNonQuery();
OraRefCursor oraRefCursor = (OraRefCursor) oraCommand.Parameters["my_ref_cursor"].Value;
OraDataReader oraDataReader = oraRefCursor.GetDataReader();

paymentMethodGrid.DataSource = oraDataReader;
paymentMethodGrid.DataBind();

/*
while (oraDataReader.Read())
{
Response.Write(oraDataReader["id"].ToString() + "<br>\n");
}
*/
}
catch (Exception mE)
{
throw mE;
}
finally
{
oraConnection.Close();
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 30 2002
Added on Jul 26 2002
2 comments
260 views