A
Adnan Strujic
I'm developing paging control. One of the properties of this control is
SqlConn propertie.
When i set this property from designer, I receive error that you can see
bellow. I spent 3 days trying to figure out this problem without any
success.
Please help
This is SqlConn property:
-----------------------------------------------------
[Bindable(true),
Description("Set SQL Connection"),
Category("Data"),
DefaultValue(null),
TypeConverter(typeof(SqlConnection))]
public virtual SqlConnection SqlConn
{
get
{
return sqlConn;
}
set
{
sqlConn = value;
}
}
This is error that I receive when I try to run application that use my
control:
--------------------------------------------------------------
Server Error in '/TestApplication' Application.
----------------------------------------------------------------------------
----
Unable to generate code for a value of type
'System.Data.SqlClient.SqlConnection'. This error occurred while trying to
generate the property value for SqlConn.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Unable to generate code for a
value of type 'System.Data.SqlClient.SqlConnection'. This error occurred
while trying to generate the property value for SqlConn.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Unable to generate code for a value of type
'System.Data.SqlClient.SqlConnection'. This error occurred while trying to
generate the property value for SqlConn.]
System.Web.Compilation.CodeDomUtility.GenerateExpressionForValue(PropertyInf
o propertyInfo, Object value, Type valueType)
System.Web.Compilation.TemplateControlCompiler.BuildBuildMethod(ControlBuild
er builder, Boolean fTemplate, PropertySetterEntry pse)
System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilde
r(ControlBuilder builder, Boolean fInTemplate, PropertySetterEntry pse)
System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilde
r(ControlBuilder builder, Boolean fInTemplate, PropertySetterEntry pse)
System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilde
r(ControlBuilder builder, Boolean fInTemplate, PropertySetterEntry pse)
System.Web.Compilation.TemplateControlCompiler.BuildMiscClassMembers()
System.Web.Compilation.PageCompiler.BuildMiscClassMembers()
System.Web.Compilation.BaseCompiler.BuildSourceDataTree()
System.Web.Compilation.BaseCompiler.GetCompiledType()
System.Web.Compilation.PageCompiler.CompilePageType(PageParser
pageParser)
System.Web.UI.PageParser.CompileIntoType()
System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation()
[HttpException (0x80004005): Unable to generate code for a value of type
'System.Data.SqlClient.SqlConnection'. This error occurred while trying to
generate the property value for SqlConn.]
System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
fCreateIfNotFound)
System.Web.UI.TemplateParser.GetParserCacheItem()
System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String
virtualPath, String inputFile, HttpContext context)
System.Web.UI.TemplateControlParser.GetCompiledInstance(String
virtualPath, String inputFile, HttpContext context)
System.Web.UI.PageParser.GetCompiledPageInstanceInternal(String
virtualPath, String inputFile, HttpContext context)
System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String
requestType, String url, String path)
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep
..Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
SqlConn propertie.
When i set this property from designer, I receive error that you can see
bellow. I spent 3 days trying to figure out this problem without any
success.
Please help
This is SqlConn property:
-----------------------------------------------------
[Bindable(true),
Description("Set SQL Connection"),
Category("Data"),
DefaultValue(null),
TypeConverter(typeof(SqlConnection))]
public virtual SqlConnection SqlConn
{
get
{
return sqlConn;
}
set
{
sqlConn = value;
}
}
This is error that I receive when I try to run application that use my
control:
--------------------------------------------------------------
Server Error in '/TestApplication' Application.
----------------------------------------------------------------------------
----
Unable to generate code for a value of type
'System.Data.SqlClient.SqlConnection'. This error occurred while trying to
generate the property value for SqlConn.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Unable to generate code for a
value of type 'System.Data.SqlClient.SqlConnection'. This error occurred
while trying to generate the property value for SqlConn.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Unable to generate code for a value of type
'System.Data.SqlClient.SqlConnection'. This error occurred while trying to
generate the property value for SqlConn.]
System.Web.Compilation.CodeDomUtility.GenerateExpressionForValue(PropertyInf
o propertyInfo, Object value, Type valueType)
System.Web.Compilation.TemplateControlCompiler.BuildBuildMethod(ControlBuild
er builder, Boolean fTemplate, PropertySetterEntry pse)
System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilde
r(ControlBuilder builder, Boolean fInTemplate, PropertySetterEntry pse)
System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilde
r(ControlBuilder builder, Boolean fInTemplate, PropertySetterEntry pse)
System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilde
r(ControlBuilder builder, Boolean fInTemplate, PropertySetterEntry pse)
System.Web.Compilation.TemplateControlCompiler.BuildMiscClassMembers()
System.Web.Compilation.PageCompiler.BuildMiscClassMembers()
System.Web.Compilation.BaseCompiler.BuildSourceDataTree()
System.Web.Compilation.BaseCompiler.GetCompiledType()
System.Web.Compilation.PageCompiler.CompilePageType(PageParser
pageParser)
System.Web.UI.PageParser.CompileIntoType()
System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation()
[HttpException (0x80004005): Unable to generate code for a value of type
'System.Data.SqlClient.SqlConnection'. This error occurred while trying to
generate the property value for SqlConn.]
System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
fCreateIfNotFound)
System.Web.UI.TemplateParser.GetParserCacheItem()
System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String
virtualPath, String inputFile, HttpContext context)
System.Web.UI.TemplateControlParser.GetCompiledInstance(String
virtualPath, String inputFile, HttpContext context)
System.Web.UI.PageParser.GetCompiledPageInstanceInternal(String
virtualPath, String inputFile, HttpContext context)
System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String
requestType, String url, String path)
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep
..Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)