I need an example of code where I can bind data into a gridview
this is my code where I load my entire data from sql
just want an example to start
Code:
public IList<T> loadEntity<T>() where T : class
{
IList<T> data = new List<T>();
ISessionFactory factory = null;
ISession session = null;
ITransaction transaction = null;
try
{
factory = cfg.BuildSessionFactory();
session = factory.OpenSession();
transaction = session.BeginTransaction();
data = session.CreateCriteria(typeof(T)).List<T>();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
transaction.Rollback();
if (transaction != null) transaction.Rollback();
}
finally
{
if (transaction != null) transaction.Dispose();
session.Close();
factory.Close();
}
return (data);
}