private void dashboardControl1_ConfigureDataConnection(object sender, DashboardConfigureDataConnectionEventArgs e) { CustomStringConnectionParameters parameters = e.ConnectionParameters as CustomStringConnectionParameters; if (e.DataSourceName == "MySqlDataSource") { parameters.ConnectionString = @"XpoProvider=MSSqlServer;Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\NWind.mdf;Integrated Security=True"; } }
public ThongKeHoaDon_Control() { InitializeComponent(); string connectionString = @"Data Source=.;Initial Catalog=QuanLyHoaDon;Integrated Security=True"; CustomStringConnectionParameters connectionParameters = new CustomStringConnectionParameters(connectionString); SqlDataSource ds = new SqlDataSource(connectionParameters); // This line of code is generated by Data Source Configuration Wizard hoaDonBanTableAdapter1.Fill(quanLyHoaDonDataSet1.HoaDonBan); }
private void sqlDataSource1_ConfigureDataConnection(object sender, DevExpress.DataAccess.Sql.ConfigureDataConnectionEventArgs e) { //string connectionString = @"XpoProvider=MSSqlServer;Data Source=('" + ClassGenLib.ServerIP + "');User ID=sa;Password=;Initial Catalog=database;Persist Security Info=true;"; //CustomStringConnectionParameters connectionParameters = new CustomStringConnectionParameters(connectionString); //SqlDataSource ds = new SqlDataSource(connectionParameters); //this.DataSource = ds; string connectionString = @"XpoProvider=MSSqlServer;Data Source=('" + ClassGenLib.ServerIP + "');User ID=sa;Password=;Initial Catalog=database;Persist Security Info=true;"; CustomStringConnectionParameters connectionParameters = new CustomStringConnectionParameters(connectionString); SqlDataSource ds = new SqlDataSource(connectionParameters); sqlDataSource1.Connection.ConnectionString = ClassDBUtils.DBConnString; }
// Collection public void BindToData(XtraReport report) { Model1 MyContext = new Model1(); var MyList1 = MyContext.Employes.ToList(); MyList = new ObservableCollection <Employe>(MyList1); string ConnectionString = MyContext.Database.Connection.ConnectionString; CustomStringConnectionParameters connectionParameters = new CustomStringConnectionParameters(ConnectionString); report.DataSource = MyList; }
private SqlDataSource GetDataSourceForQueryBuilder() { var form = GetMainWindow(); IWaitFormActivator waitFormActivator = new WaitFormActivator(form, typeof(WaitFormWithCancel), true); IExceptionHandler exceptionHandler = new ExceptionHandler(UserLookAndFeel.Default, form); var currentServer = App.Connection.GetServerAtInstanceName(App.Connection.CurrentServer.Name, App.Connection.CurrentDatabase.Name); var dxConnectionStringParameters = new CustomStringConnectionParameters(currentServer.ConnectionContext.ConnectionString); var dxSqlDataSource = new SqlDataSource(dxConnectionStringParameters); ConnectionHelper.OpenConnection(dxSqlDataSource.Connection, exceptionHandler, waitFormActivator, null); return(dxSqlDataSource); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services .AddMvc() .AddDefaultDashboardController((configurator, serviceProvider) => { //var connection = new SqlConnection(ConnectionString); var dashboardStorage = new DataBaseEditaleDashboardStorage(); configurator.SetDashboardStorage(dashboardStorage); var conexao = new SqlConnectionStringBuilder(Configuration.GetConnectionString("BrickConnStr")); conexao.UserID = "usr_cdis_report"; conexao.Password = "******"; var parameters = new CustomStringConnectionParameters(conexao.ConnectionString); var sqlDataSource = new DashboardSqlDataSource("Fonte de dados padrão", parameters); var dataSourceStorage = new DataSourceInMemoryStorage(); dataSourceStorage.RegisterDataSource("sqlDataSource1", sqlDataSource.SaveToXml()); configurator.SetDataSourceStorage(dataSourceStorage); /*const string defaultSourceName = "Fonte de dados padrão"; * const string connectionName = "mssql-connection"; * var sqlDataSource = new DashboardSqlDataSource(defaultSourceName, connectionName); * var dataSourceStorage = new DataSourceInMemoryStorage(); * dataSourceStorage.RegisterDataSource("sqlDataSource1", sqlDataSource.SaveToXml()); * configurator.SetDataSourceStorage(dataSourceStorage); * * configurator.ConfigureDataConnection += (s, e) => * { * if (e.ConnectionName == connectionName) * { * var conexao = new SqlConnectionStringBuilder(ConnectionString); * conexao.UserID = "usr_cdis_report"; * conexao.Password = "******"; * e.ConnectionParameters = new CustomStringConnectionParameters(conexao.ConnectionString); * } * };*/ //configurator.SetConnectionStringsProvider(new MyDataSourceWizardConnectionStringsProvider()); configurator.ConfigureDataConnection += (s, e) => { }; configurator.AllowExecutingCustomSql = true; DashboardConfigurator.PassCredentials = true; }); services.AddDevExpressControls(settings => settings.Resources = ResourcesType.ThirdParty | ResourcesType.DevExtreme); }
static string GetConnectionString(DataConnectionParametersBase connectionPars) { CustomStringConnectionParameters customConnectionPars = connectionPars as CustomStringConnectionParameters; if (customConnectionPars != null) { return(customConnectionPars.ConnectionString); } JsonSourceConnectionParameters jsonConnectionPars = connectionPars as JsonSourceConnectionParameters; if (jsonConnectionPars != null) { if (jsonConnectionPars.JsonSource == null) { throw new Exception(); } JsonDataConnection jsonConnection = new JsonDataConnection(jsonConnectionPars.JsonSource); return(jsonConnection.CreateConnectionString()); } throw new Exception(); }
private DashboardSqlDataSource CreateDataSource() { CustomStringConnectionParameters connectionParameters = new CustomStringConnectionParameters(); connectionParameters.ConnectionString = @"XpoProvider=MSSqlServer;Data Source=(LocalDB)\MSSQLLocalDB;" + @"AttachDbFilename=|DataDirectory|\NW19.mdf;" + @"Integrated Security=True"; DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("NW19 SQL Server Database File", connectionParameters); // Comment out two lines to use CustomSqlQuery and SQL string expression. SelectQuery selectQuery = CreateSqlQuery(); sqlDataSource.Queries.Add(selectQuery); // Uncomment two lines to to use CustomSqlQuery and SQL string expression. //CustomSqlQuery selectQuery = CreateSqlStringQuery(); //sqlDataSource.Queries.Add(selectQuery); sqlDataSource.CalculatedFields.AddRange(CreateCalculatedFields(selectQuery)); sqlDataSource.Fill(); return(sqlDataSource); }
private void sqlDataSource1_ConfigureDataConnection(object sender, DevExpress.DataAccess.Sql.ConfigureDataConnectionEventArgs e) { //using (var settings = new ApplicationSettings()) //{ // var sqlConnection = new SqlConnection(settings.GetConnectionString("connBNOTE")); // var sqlConnectionStringBuilder = new SqlConnectionStringBuilder(sqlConnection.ConnectionString); // var dataConnectionParametersBase = new MsSqlConnectionParameters // { // ServerName = sqlConnectionStringBuilder.DataSource, // DatabaseName = sqlConnectionStringBuilder.InitialCatalog, // UserName = sqlConnectionStringBuilder.UserID, // Password = sqlConnectionStringBuilder.Password, // AuthorizationType = sqlConnectionStringBuilder.IntegratedSecurity ? MsSqlAuthorizationType.Windows : MsSqlAuthorizationType.SqlServer // }; // e.ConnectionParameters = dataConnectionParametersBase; //} //string connectionString = @"XpoProvider=MSSqlServer;Data Source=('"+ClassGenLib.ServerIP+"');User ID=sa;Password=;Initial Catalog=database;Persist Security Info=true;"; string connectionString = @"XpoProvider=MSSqlServer;data source=.;User ID=sa;Password=;Initial Catalog=NewFalconTest;Persist Security Info=true;"; CustomStringConnectionParameters connectionParameters = new CustomStringConnectionParameters(connectionString); SqlDataSource ds = new SqlDataSource(connectionParameters); //this.DataSource = ds; }