DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Sorting a Datagrid column

  1. #1
    Join Date
    Jan 2008
    Posts
    19

    Unhappy Sorting a Datagrid column

    I am trying to sort a datagrid by any of the column headers that might be clicked on, I got as far as identifying the field to sort by and then errors kick in. Below is the code I have put in the headclick event of my datagrid(DatPBCC).

    Code:
    frmOutListProcessed.AdcPBCC.RecordSource = "Select * From BKL_ProcessedBankings Order By " & _
    frmOutListProcessed.DatPBCC.Columns(ColIndex).DataField
        
       
    frmOutListProcessed.AdcPBCC.Refresh
    The first error message I get is: "[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.

    Followed by another error: "Run time error '-2147217900'
    method 'Refresh' of object 'IAdodc' failed.

    When I debug my code it does fetch the correct column( anyone I decide to click on), but the code falls over when it has to refresh my Adodc(AdcPBCC) control.

    Can someone kindly help resolve this if they know how.

    Thanks for you assistance.

    Bode

  2. #2
    Join Date
    Apr 2008
    Posts
    28
    Hi Bode,

    Your problem lies on your Adodc(AdcPBCC) control. Your control should be set to:

    AdcPBCC.CommandType = adCmdText
    AdcPBCC.RecordSource = "Select * From BKL_ProcessedBankings"



    or you can manually set your Adodc(AdcPBCC) control by right clicking and go to the Recordsource Tab.


  3. #3
    Join Date
    Jan 2008
    Posts
    19
    Hi Rollete,

    Thank you very much, I made the changes and it worked.

    Ever so greatful

    Bode


Similar Threads

  1. Replies: 3
    Last Post: 10-07-2007, 03:14 PM
  2. Help Please with sorting XML data in datagrid
    By Cab_0001 in forum ASP.NET
    Replies: 7
    Last Post: 01-18-2007, 09:33 PM
  3. Set datagrid column width
    By kero in forum ASP.NET
    Replies: 3
    Last Post: 10-21-2005, 08:56 AM
  4. DataGrid Column Headers
    By Greg Rothlander in forum ASP.NET
    Replies: 3
    Last Post: 10-23-2003, 02:55 PM
  5. CheckBox Column in a DataGrid ?
    By Jim H in forum .NET
    Replies: 1
    Last Post: 06-11-2001, 06:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center