开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜