vb.net - WPF Bind a ListView to Oracle Data Source -
Here's a part of XAM which I'm working on:
Lt; ListView Name = "lsvCustomerDetails" ItemsSource = "{MyDataTable Binding}" & gt; & Lt; ListView.View & gt; & Lt; GridView & gt; & Lt; GridViewColumn Header = "Script Name" DisplayMemberBinding = "{Binding ID}" /> & Lt; GridViewColumn header = "status" DisplayMemberBinding = "{binding status}" /> & Lt; GridViewColumn Header = "Date" DisplayMemberBinding = "{Binding Date}" /> & Lt; / GridView & gt; & Lt; /ListView.View> & Lt; / ListView & gt;
and related VB.NET:
class window 1 private sub Window_Loaded as public myDataTable DataTable (ByVal sender as the object, ByVal e) objOracleConnection as the Oracle Connection ("Data Source = DB; User ID = User; Password = Password;") and Commands Omokoric as OracleDand Reader Ozakrakal Connection in OracleMand Dime Ozoracic Reader Open () Ojokakrak Command. Connection = Opaque connections. Command text "select" customers "objOracleReader = objOracleCommand.ExecuteReader () objOracleConnection as the use of low objOracleAdapter OracleDataAdapter = new OracleDataAdapter (objOracleCommand.CommandText, objOracleConnection) objOracleAdapter.Fill (myDataTable) end-use lsvCustomerDetails.DataContext = myDataTable objOracleConnection. the Close () uses other end to end, so
what this code is correct to fill the table? If not, why? to be honest, I like things Many perspectives about how to do it Some of which are linked from below:
< p> have you considered using LINQ? it's very simple ...
Add data unit models in your project. Read and then use LINQ to its binding. < / P>
something like:
new MyOracleEntityModel as myTableEntityModel Dim Context = Context.myCustomers.ToList myItemSource = Kaidi, i.status, i.date lsvCustomerDetails.ItemSource = MyItemSource
to load data unit model for Oracle The only trick.
Comments
Post a Comment