質問する質問する
 

回答済みHow to connect wpf with database

  • 2008年3月3日 15:35ToDayIsNow ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    how can I connect a WPF project to SQL Server 2005
    I try to do it like I do in past with Windows Form Application
    but I cant do it
    I think that their is a new way to connect to database with WPF Application , so plz tell me about it and if any examples or links for help
    thank you alot




回答

  • 2008年3月3日 16:23Thomas Claudius Huber ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     回答済み

    In WPF you could also use ADO.NET and bind e.g. to the tables in a dataset. But up to now there are now wizards in Visual Studio for data connection. E.g. you can't drop tables out of DataSource-Explorer onto your form. Possibilities:

    • Add a typed DataSet to your Project, add Tables and TableAdapters, use TableAdapters to load data and bind your UI to the Data
    • Instead of DataSets you could also use Linq to SQL and bind to your special objects.
    • ...

    You should take a look at Data Binding (which is much more than only binding to data from a dataset) and especially at the interface ICollectionView and the three classes CollectionView, ListCollectionView and BindingListCollectionView. In WPF you don't use a BindingSource-Objekt (and so a CurrencyManager) to manage the currentItem. Instead you use an ICollectionView that manages the currentItem and Position of the Collection it points to.

  • 2008年3月3日 17:42Mike Cook - MSFT ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     回答済み

     

    I highly recommend you take a look at a new technology we released with .NET 3.5 called LINQ to SQL.  LINQ stands for "Language Integrated Query", and allows you to write really intuitive code to interface with your database.  Here's a link to a short 10-minute video that should be able to help you get up and running.

     

    http://asp.net/learn/videos/video-232.aspx

すべての返信

  • 2008年3月3日 16:23Thomas Claudius Huber ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     回答済み

    In WPF you could also use ADO.NET and bind e.g. to the tables in a dataset. But up to now there are now wizards in Visual Studio for data connection. E.g. you can't drop tables out of DataSource-Explorer onto your form. Possibilities:

    • Add a typed DataSet to your Project, add Tables and TableAdapters, use TableAdapters to load data and bind your UI to the Data
    • Instead of DataSets you could also use Linq to SQL and bind to your special objects.
    • ...

    You should take a look at Data Binding (which is much more than only binding to data from a dataset) and especially at the interface ICollectionView and the three classes CollectionView, ListCollectionView and BindingListCollectionView. In WPF you don't use a BindingSource-Objekt (and so a CurrencyManager) to manage the currentItem. Instead you use an ICollectionView that manages the currentItem and Position of the Collection it points to.

  • 2008年3月3日 17:42Mike Cook - MSFT ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     回答済み

     

    I highly recommend you take a look at a new technology we released with .NET 3.5 called LINQ to SQL.  LINQ stands for "Language Integrated Query", and allows you to write really intuitive code to interface with your database.  Here's a link to a short 10-minute video that should be able to help you get up and running.

     

    http://asp.net/learn/videos/video-232.aspx

  • 2008年3月3日 19:55ToDayIsNow ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    thankx alot for ur answers
    and really thank you for the video