On Sun, Dec 28, 2008 at 11:13 PM, Ajoy Khaund <[email protected]> wrote:
>> Are you binding your data against objects or tables in datasets?  Go
>> the Object route!!!!  Drop the whole idea of that dumb cursor concept.
>> It is so 1900s.
>
> Stephen
>
> Can you just write a few lines on the above. Is it copy data from a record
> in a table or cursor to a object and bind the object to the form textbox,
> spinner, etc.
>
> Anything will help to gain some knowledge.
------------------------

This url is a 4 page article that goes into the whole thing.

http://www.15seconds.com/issue/040614.htm

Now to do things in a better way, you could try nHibernate a free set
of DLLs that will do a lot for your data mapping:
<http://www.hibernate.org/343.html>

If you had 3.5 you could use the ER that comes with VS2008.

<http://blogs.class-a.nl/blogs/anko/archive/2007/11/01/linq-to-sql-is-the-data-access-layer-dal.aspx>

Code from that blog:
public static class DataHelper

{

  public static IQueryable<Restaurant> GetAllRestaurants()   // you
have an object Restaurant that is

                 // only a a schema shell to type data.

  {

     DinnerNowDataContext context = new DinnerNowDataContext();  //
DinnerNowDataContext is the
                                     // ER that you built by looking
at your data and adding tables to it.
                                     // It has all the connection
stuff wired up all you do is call it above and use it
                                     // below to return a dataset or
list or rows.

     return from r in context.Restaurant     // this is your request

            select r;                                   // this RUNS your query.

  }

}


So I have a IQueryable<Restaurant> object.  I can then bind that to a
Listbox in my gui.

RestaurantList.DataSource = myCallForDataHere.GetRestaurants();
//call of method for data
                
RestaurantList.DataTextField = "RestaurantName";  //set of display
                                
RestaurantList.DataValueField = "RestaurantID";  // set of ID from list
                                
RestaurantList.DataBind();   // use it

-- 


Stephen Russell
Sr. Production Systems Programmer
Mimeo.com
Memphis TN

901.246-0159


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to