1

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?

M.Othman
  • 40
  • 6
  • You can get a lot of the same information from database by querying the schema of the tables. That is really what the datasource wizard is doing. See posting : http://stackoverflow.com/questions/730421/getting-the-sql-server-schema-for-a-table – jdweng Sep 14 '16 at 16:55

2 Answers2

0

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 ();
M.Othman
  • 40
  • 6
0

Maybe this will help how to get the query string from xtrareport data source;

DevExpress.DataAccess.Sql.SqlDataSource datasource=(DevExpress.DataAccess.Sql.SqlDataSource)report.DataSource;

if (datasource.Queries[0] is DevExpress.DataAccess.Sql.TableQuery)
    sqlQuery = (datasource.Queries[0] as DevExpress.DataAccess.Sql.TableQuery).GetSql(datasource.Connection.GetDBSchema());
else
{
    DevExpress.DataAccess.Sql.CustomSqlQuery sq = (DevExpress.DataAccess.Sql.CustomSqlQuery)sqd.Queries[0];
    sqlQuery = datasource.Sql;
}

query = sqlQuery.Replace("'\'", "''");
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459