Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

asp.net : paging on a gridview with OleDbDataReader as datasource

  • 15-01-2008 1:39pm
    #1
    Registered Users, Registered Users 2 Posts: 872 ✭✭✭


    Hi,

    Im passing up data from an access db as a OleDbDataReader object. I then bind this to a gridview. When i try and enable paging i get an error The data source does not support server-side data paging.

    Is there an easy workaround for this ? Thanks
    public static OleDbDataReader connectDb(string sql)
        {
            //create the database connection
            OleDbConnection aConnection = new OleDbConnection(dbConnection);
    
            //create the command object and store the sql query
            OleDbCommand aCommand = new OleDbCommand(sql, aConnection);
    
            aConnection.Open();
    
            OleDbDataReader aReader = aCommand.ExecuteReader();
    
            return aReader;
            
            aConnection.Close();
        }
    


Comments

  • Registered Users, Registered Users 2 Posts: 610 ✭✭✭nialo


    Your using a datareader instead of a dataset. switch to a dataset and it should work fine.


  • Registered Users, Registered Users 2 Posts: 872 ✭✭✭grahamor


    I cant seem to convert my OleDbDataReader to a dataset, do you know how i can do this?

    Would i be better connecting to the access db some other way ?

    Thanks for the help


  • Registered Users, Registered Users 2 Posts: 610 ✭✭✭nialo


    Code adapted...
    grahamor wrote: »
    Hi,
    public static DataSet connectDb(string sql)
        {
            //create the database connection
            OleDbConnection aConnection = new OleDbConnection(dbConnection);
    
            //create the command object and store the sql query
            OleDbCommand aCommand = new OleDbCommand(sql, aConnection);
    
            aConnection.Open();
    
                                             Dataset myDataset = new Dataset() 
             OleDbDataAdapter myAdapter = new OleDbDataAdapter(aCommand) 
             myAdapter.Fill(myDataset) 
     
             return myDataset; 
    
        }
    


  • Registered Users, Registered Users 2 Posts: 872 ✭✭✭grahamor


    Thanks for all your help Nialo


Advertisement