Class files in App_Code |
|
Answered By
Moderator1
on
1/2/2010 9:43:47 PM |
|
|
|
|
Hi,
You need to place the CustomerCls file in the App_Code Directory of your solution.
To add App_Code folder to your solution, Right-Click on your Project > go to Add ASP.NET Folder > App_Code. This will add App_Code folder in your solution, then cut and paste the CustomerCls inside App_Code, then run your application.
Connection String in Web.Config file can be as follows,
<connectionStrings>
<add name="ConnectionString" connectionString="Initial Catalog=HOME;Data Source=localhost;Uid=xxsaxx;Pwd=xxpwdxx;"/>
</connectionStrings>
To access web.config file from application, do as below,
private string cnstr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
If you still have questions regarding this, post it here. |
|
|
|
help |
|
Answered By
sarita
on
12/22/2010 6:41:05 PM |
|
|
|
|
public class CustomersCls
{
private string cnstr = ConfigurationManager.ConnectionStrings["cnstr"].ToString(); //error in this section
Object reference is not set to instance of an object..
private string sql;
Please help me with this code.. |
|
|
|