Search code examples
c#wpfdevexpresssql-server-cextrareport

how to bind XtraReport to password protected sqlce(3.5) in C# wpf?


currently, I am developing Desktop Application with Password Protected Database(.sdf). I have database(password protected) successful connection to the data table adapter in C# but, Now I am confused about How to bind sqlce(3.5) data to the XtraReport(DevExpress) because it needs password to access data from sqlce 3.5 and I have tried lots of thing as my knowledge but I couldn't found anything so, I don't have any idea about that so help me in making connection between database(password protected) and XtraReport or Crystal Report please ...


Solution

  • Generally it is necessary to modify the connection string. If you don't want to store password in the application settings you should make changes on the fly.

    string password = GetPasswordFromTheUser();
    XtraReport report = new MyReport();
    SomeTableTableAdapter adapter = (SomeTableTableAdapter)report.DataAdapter;
    adapter.Connection.ConnectionString += ";Password=" + password;
    report.ShowPreviewDialog();