-
-
Save hnjm/ee1e916ab2fd81e8c2f53d6f41035cd4 to your computer and use it in GitHub Desktop.
[DevExpress][XPO] Session.ExecuteQuery() using a parameterized SQL query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dataStore = new InMemoryDataStore(); | |
var dataLayer = new SimpleDataLayer(dataStore); | |
using (var uow = new UnitOfWork(dataLayer)) | |
{ | |
var sql = "SELECT Id, Name FROM BookGenre WHERE Name = @Name"; | |
var pNames = new string[] { "Name" }; | |
var pValues = new object[] { "Computer" }; | |
var dbData = uow.ExecuteQuery(sql, pNames, pValues); | |
var view = new XPDataView(); | |
view.AddProperty("Id", typeof(int)); | |
view.AddProperty("Name", typeof(string)); | |
view.LoadData(dbData); | |
grdMain.ItemsSource = view; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment