這將是我的第一個問題,所以請寬大。受保護的成員可見用戶
這怎麼可能:
//there is a Form1 class which has a TableAdapter member generated by designer...
partial class Form1
{
private void InitializeComponent()
{
this.SomeTableTableAdapter = new SomeDatabaseDataSetTableAdapters.SomeTableTableAdapter();
}
private SomeDatabaseDataSetTableAdapters.SomeTableTableAdapter SomeTableTableAdapter;
}
//here is this TableAdapter class
//It has PROTECTED member called "Adapter"
public partial class SomeTableTableAdapter : global::System.ComponentModel.Component
{
protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter
{
}
}
//and in the constructor of Form1 class I can do something like this:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.SomeTableTableAdapter.Adapter.InsertCommand.CommandText = @"INSERT INTO (...)";
}
}
爲什麼我得到的,因爲Form1中訪問受保護的成員不從SomeTableTableAdapter繼承?
請使用網站功能回覆答案,如發表評論。由於這是一個問答網站,其實答案並不是[答案]將被刪除](http://stackoverflow.com/faq#deletion)。不要忘記標記答案已被接受。 – GSerg 2012-08-11 16:02:28