Clear All Cells Value and rebind datasource ADODB.Recordset

5 posts, 0 answers
  1. Kencana
    Kencana avatar
    6 posts
    Member since:
    Feb 2016

    Posted 09 Sep Link to this post

    Hi..Telerik Team

    How to clear all cells value after binding a data then reload data. Here's my code.

    Class Module

        Public Function GetDataTable(ByVal Query As String) As DataTable
            Dim adapter As New SqlDataAdapter()
            Dim mydt As New DataTable()
            Using Conn As New SqlConnection(DBConnection)
                adapter.SelectCommand = New SqlCommand(Query, Conn)
                adapter.Fill(mydt)
            End Using
            Return mydt
        End Function

    ---> i use above function to binding data into my grid and succeed

    - Click NEW button then clear all cells value just loaded.My code as below

        Me.RadGridView1.DataSource = New DataTable()

    - Click LOAD button to load another data

        dim vQstr as string = "SELECT * FROM table"

        RadGridView1.DataSource = objDB.GetDataTable(vQStr)

    1. problem is when i load another data, my grid didnt show any data. Please kindly help

    2. can manually save gridview data records into database by clicking a button, but user allows to add, edit and delete row before do saving

    Thank you

  2. Kencana
    Kencana avatar
    6 posts
    Member since:
    Feb 2016

    Posted 09 Sep Link to this post

    Just info.. in VB6 i can use code below to clear my grid and rebind my data as well

    msflexgrid1.clear

    msflexgrid1.rows = 2

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Hristo
    Admin
    Hristo avatar
    714 posts

    Posted 09 Sep Link to this post

    Hi Kencana,

    Thank you for writing.

    Before getting to your question, we would like to check something related to your license. Your account shows no purchases and it seems that you have not downloaded the WinForms suite from our site. Since it is our policy to support users in good account standing, I would kindly ask you to give us more details on the license you are using:
    - In case you have downloaded it from another site/account, please let us know so that we can update your account and provide you with proper support services; 

    - In case you have obtained a copy of our controls through the company you work for, please ask the account holder to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system.

    Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: http://www.telerik.com/faq. I have moved your Forum post to our support ticketing system (which is private communication channel) to avoid sharing confidential information in the public Forums. You can find the ticket in Your Telerik Account.

    As to your first question, setting the data source to null or to a new DataTable object should be enough to update the grid. The code snippet you sent me appears to be incomplete and I cannot test it. Please send me a sample project according to your setup.
    Regarding your other question, please check the following documentation article demonstrating how the database can be updated using ADO.NET: http://docs.telerik.com/devtools/winforms/gridview/populating-with-data/updating-the-database-with-ado.net

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
  5. Kencana
    Kencana avatar
    6 posts
    Member since:
    Feb 2016

    Posted 09 Sep Link to this post

    Hi..Hristo

    To clear your doubt.

    I am downloaded Telerik from official site (www.telerik.com) since last year. I am stop using Telerik since early of 2016 because of several reasons. then at this moment try to testing Telerik again because interest how RadGrid serve a data. I am still can using Telerik with free trial license on my new computer that downloaded first time.

    Anyway from the link http://docs.telerik.com/devtools/winforms/gridview/populating-with-data/updating-the-database-with-ado.net you post havent solve the problem.

  6. Hristo
    Admin
    Hristo avatar
    714 posts

    Posted 13 Sep Link to this post

    Hi Kencana,

    Thank you for writing.

    The data bound object used to populate the grid records is updated from the grid control. Depending on the chosen approach to interact with your database it is up to you to decide how you will update it.

    You can also check the following forum threads discussing a similar topic: I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready