开发者

How do I connect a dataGrid to a DataSet [duplicate]

This question already has an answer here: How to bind a table in a dataset to a WPF datagrid in C# and XAML (1 answer) Closed 9 years ago.
using System.Windows;

namespace Telephone_Directory
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            telephone2010DataSet dataSet = new telephone2010DataSet();

            telephone2010DataSetTableAdapter adapter = 
                new telephone2010DataSetTableAdapter();
        }
    }
}

The above is my code is a new project. Visual Studio 2010 complains that " the type o开发者_Go百科r namespace 'telephone2010DataSetTableAdapter' could not be found."

I created a new solution. I right clicked the solution name and selected "Add Existing Item" and located my Microsoft Access DB file. I followed the wizard and it setup the necessary XSD files.

I started coding and I got this message. I did a little google-ing and I cant figure it out.

This is a WPF application created with Visual Studio 2010.


If you used VS.NET to create the typed data sets (btw, you might want to take a look at LINQ-to-Entities, as it's a better model), you should see another namespace under the Telephone_Directory namespace which contains the typed data sets/adapters/etc.

Additionally, in VS.NET, you can always right-click on the teleophone2010DataSet type name and select "Resolve" which will then place the using statement at the top of the code file or use the namespace-qualified type name where appropriate (it's your choice) if the type is unresolved.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜