Reputation: 33
I'm writing an application in c# using wpf and i was wondering how do you create a data table in wpf? This is a really dumb question, i'm aware, but it doesn't appear like i'm using the correct references as the data table object never appears when i try to create it. My references are as follows:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;
using System.Linq;
using System.ComponentModel;
using System.Data.Sql;
Upvotes: 3
Views: 26171
Reputation: 8792
Here's a method that creates a DataTable...
private void CreateDataTable()
{
System.Data.DataTable dt = new DataTable("MyTable");
dt.Columns.Add("MyColumn", typeof (string));
dt.Rows.Add("row of data");
}
The relevant assembly (as identified by HighCore in the commentary) is System.Data. If it is not included in your references, you can add it via the 'add reference' context menu.
Upvotes: 6