You must Sign In to post a response.
  • Category: ASP.NET

    'System.Data.OleDb.OleDbCommand' does not contain a definition for 'BeginExecuteReader

    'System.Data.OleDb.OleDbCommand' does not contain a definition for 'BeginExecuteReader


    if am using Sql Server 2005 the problem doesn't exist..
    what to do ...

    plsss help ..
  • #483850
    Hi,

    Can you please tell us when exactly you are getting this error?

    If possible post the code too.


    Thanks & Regards


    Bunty

  • #483853
    i am getting the error in the compile time itself..

    please have a look at my code below...


    using System;
    using System.Data;
    using System.Data.OleDb;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.Configuration;

    public partial class AsyncDataBind : System.Web.UI.Page
    {
    private OleDbConnection _connection;
    private OleDbCommand _command;
    private OleDbDataReader _reader;

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    AddOnPreRenderCompleteAsync(
    new BeginEventHandler(BeginAsyncOperation),
    new EndEventHandler(EndAsyncOperation)
    );
    }
    }

    IAsyncResult BeginAsyncOperation(object sender, EventArgs e, AsyncCallback cb, object state)
    {
    // connect string Path = Server.MapPath("temp") + "\\" + Session.SessionID.ToString() + ".xls";
    _connection = new OleDbConnection(connect);
    _connection.Open();
    _command = new OleDbCommand("SELECT * FROM [CUST_LIST_WHL$]", _connection);
    return _command.BeginExecuteReader(cb, state);
    }

    void EndAsyncOperation(IAsyncResult ar)
    {
    _reader = _command.EndExecuteReader(ar);
    }

    protected void Page_PreRenderComplete(object sender, EventArgs e)
    {
    Output.DataSource = _reader;
    Output.DataBind();
    }

    public override void Dispose()
    {
    if (_connection != null)
    _connection.Close();
    base.Dispose();
    }
    }

  • #483862
    try like this

    AsyncCallback callback = new AsyncCallback(Callback1);
    command.BeginExecuteReader(callback, command);

    senthilkumar

  • #483864
    Mr. Senthil Kumar,

    my problem is .. the oledb command object itself is not recognizing the BeginExecuteReader() method.


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.