H
hui
Here is a problem I am having with web form designer. I have a database
control in the form, and setup the connection string as a dynamic
property. It compiles and runs fine.
I close the aspx file, reopen it, and then have an error message in
task list: "\\xxx\wwwroot$\xxx\xx.aspx.cs(68): The variable
'configurationAppSettings' is either undeclared or was never assigned"
I open the code-behind file, and find out the trouble spot at the "web
designer generated code" region. The method looks like this:
private void InitializeComponent()
{
System.Configuration.AppSettingsReader configurationAppSettings =
new System.Configuration.AppSettingsReader();
.......
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString =
((string)(configurationAppSettings.GetValue("dbConnection",
typeof(string))));
.......
}
Obviously the variable is declared and assigned locally. Go back to the
design editor, in the property window of the db connection control, the
dynamic property setting has disappeared. Yet, if I rebuild now, it
compiles and run just like before. If I any changes on the design
editor, the code-behind file is changed and the statement "
this.sqlConnection1.ConnectionString = ...." is wiped out. This is
definitely not what I want to see as I have to set it up again and
again.
Does anybody know whether it is a bug? Is there any fix or workaround?
Thanks
control in the form, and setup the connection string as a dynamic
property. It compiles and runs fine.
I close the aspx file, reopen it, and then have an error message in
task list: "\\xxx\wwwroot$\xxx\xx.aspx.cs(68): The variable
'configurationAppSettings' is either undeclared or was never assigned"
I open the code-behind file, and find out the trouble spot at the "web
designer generated code" region. The method looks like this:
private void InitializeComponent()
{
System.Configuration.AppSettingsReader configurationAppSettings =
new System.Configuration.AppSettingsReader();
.......
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString =
((string)(configurationAppSettings.GetValue("dbConnection",
typeof(string))));
.......
}
Obviously the variable is declared and assigned locally. Go back to the
design editor, in the property window of the db connection control, the
dynamic property setting has disappeared. Yet, if I rebuild now, it
compiles and run just like before. If I any changes on the design
editor, the code-behind file is changed and the statement "
this.sqlConnection1.ConnectionString = ...." is wiped out. This is
definitely not what I want to see as I have to set it up again and
again.
Does anybody know whether it is a bug? Is there any fix or workaround?
Thanks