Connect with Expertise | Find Experts, Get Answers, Share Insights

Display Data to DataGridView from ORM

C
 
Join Date: Nov 2007
Posts: 144
#1: Dec 19 '09
hello,

i usually simply use DataAdapter or DataReader to get data from database.now, i'm thinking to use ORM to help ease OO development.

but then because i have the need to display the data in a DataGridView, filling query result to a DataTable from a DataAdapter is simple enough. i don't know if it's better to use ORM or not.

is filling data generated from ORM to a DataGridView is simple enough? if the ORM framework used is NHibernate for example.

Thank you.

 
Join Date: Dec 2009
Location: Chicago Area
Posts: 1
#2: Dec 30 '09

re: Display Data to DataGridView from ORM


Yes for simple mappings, something like

Dim myQuery As IQuery = session.CreateQuery("from DB_Account where MTC_Account_Number = :acctNum")
myQuery.SetParameter("acctNum", acctNum)
usersDV.DataSource = myQuery.List()
usersDV.DataBind()


You can use an IList as the datasource.
Reply