public CSqlDataComponent()
{
this._conn=new SqlConnection();
this._comm=new SqlCommand();
this._adapter=new SqlDataAdapter();
this._comm.CommandType=CommandType.StoredProcedure;
this._comm.Connection=this._conn;
this._adapter.SelectCommand=this._comm;
}// public CSqlDataComponent(string connKey):this()
// {
// this._conn.ConnectionString=System.Configuration.ConfigurationSettings.AppSettings[connKey].ToString();
// }上面是我的构造函数我些public CSqlDataComponent(string connKey):this()
// {
是为了再调用这种构造函数的时候先执行上面的public CSqlDataComponent()
这个构造函数,而代码却不是这样执行的请问是不是我什么地方些错了
{
this._conn=new SqlConnection();
this._comm=new SqlCommand();
this._adapter=new SqlDataAdapter();
this._comm.CommandType=CommandType.StoredProcedure;
this._comm.Connection=this._conn;
this._adapter.SelectCommand=this._comm;
}// public CSqlDataComponent(string connKey):this()
// {
// this._conn.ConnectionString=System.Configuration.ConfigurationSettings.AppSettings[connKey].ToString();
// }上面是我的构造函数我些public CSqlDataComponent(string connKey):this()
// {
是为了再调用这种构造函数的时候先执行上面的public CSqlDataComponent()
这个构造函数,而代码却不是这样执行的请问是不是我什么地方些错了
CSqlDataComponent objSqlDataComponent=new CSqlDataComponent("aaa");
这样会先调用public CSqlDataComponent(),然后再调用public CSqlDataComponent(string connKey)中间的代码,我用调试状态单步跟踪出来就是这么运行的,不知道你是怎么判断他
没有按照你的要求执行的。