Search code examples
c#sqldatasourcedevexpress-windows-ui

how to use SQL datasource wizard at runtime (Devexpress) ?


there is a component in DevExpress called SQLDataSource, this component allows you to import data from any database but not at RunTime, I'm currently developing a module that import data from any database, obviously it has to be dymanique, is there a way this Wizard at Runtime?


Solution

  • I found a solution, we must first add the reference "DevExpress.DataAcess.UI" to our application, then using "DevExpress.DataAccess.UI.Sql;" After having drag the SqlDataSource, in the button that we should call the wizard:   

     SqlDataSourceUIHelper.ConfigureConnection (sqlDataSource1);
    

    And another button to "Edit Query"

     

     SqlDataSourceUIHelper.EditQuery (sqlDataSource1.Queries [ "DefaultQuery"]);
    
                 sqlDataSource1.Fill ();