The strongly typed DS is constructed by the designer. But how can I add my own code? After painstaking and excellent research, I finally found out !! 1. Create a New DS file and display its sub-files,
In VS2003, it is *. cs. In vs2005, It is the *. Designer. cs file, which is the code file defining DS. You can add your own code here. There is a problem! If you save this DS, your code will disappear !!! This is unacceptable! 2. If you use vs2005, please be happy !! On the Design page, right-click
A file is generated:
You can edit it here. Unfortunately, vs2003 does not support it. However, you must comply with the constraint of the partial keyword!
There is a problem with the above method. If you want to delete DS, the code you write will be deleted together. Logically, it can be said that (no skin is available, why ?), But what if I don't want to delete it? Extended: Because C #2.0 supports the partial keyword, it can still be implemented without the above method. If there is a strong DS type named "DataSet1", there is a table named "DataTable1" below, and then add a class, modify the code as follows: namespace ConsoleApplication3
{Public partial class DataSet1
{
Public string zp = string. Empty; public partial class DataTable1DataTable
{
Public string wx = string. Empty;
}
}
} Done !! The added code is no longer subject to DS! In this way, strong DS and their own code can work together!