Intellisense can't see Datatable Name in Dataset generated by hand
I'm trying to learn this tutorial http://www.devx.com/dotnet/Article/28678/1954 in C#, I have created the datatables but when I want to type
DsActivitiesTasks.Tasks.AddTasksRow("Email")
Intellisense doesn't see Tasks but only TasksRow and TasksDataTable and none have add method.
开发者_运维百科Did I forget to do something ?
DsActivitiesTasks
is the name of the class generated by the designer.
Tasks
is an instance property of that class, so you can only access it from an instance of the dataset.
Try creating a new instance of DsActivitiesTasks
, like this:
new DsActivitiesTasks().Tasks.AddTasksRow("Email");
Note that this code will throw away the new dataset; you'll need to store it somewhere in a field or property.
For example:
public static readonly DsActivitiesTasks Database = new DsActivitiesTasks();
//In some method:
Database.Tasks.AddTasksRow("Email");
Note that datasets are not thread-safe, so you must not work with it on multiple threads.
Instantiate DsActivitiesTasks
.
精彩评论