hi frnds
my connection string is
string constr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
and in web.config
<connectionStrings>
<add name="ConnectionString" connectionString="Server=Sever-2019; Database=Customer ; Integrated Security=True"/>
</connectionStrings>
but i am getting the error like
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error: Line 39: { Line 40: List<SelectListItem> items = new List<SelectListItem>(); Line 41: string constr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; Line 42: Line 43: using (SqlConnection con = new SqlConnection(constr))
|