hi
i am trying to assignConnectionString to aSqlDataSource within thenamespace but i am getting this error
plz advise
Object reference not set to an instance of an object.
namespace myNameSpace
{
public partial class NRP : System.Web.UI.Page
{
SqlDataSource sds1;
protected void Page_PreInit(object sender, EventArgs e)
{
sds1= new SqlDataSource();
sds1.ID = "sds1";
this.Controls.Add(sds1);
sds1.ConnectionString = ConfigurationManager.ConnectionStrings["my_conn_str"].ToString();
}
}
}
namespace myNameSpace
{
public partial class NRP : System.Web.UI.Page
{
protected void Page_PreInit(object sender, EventArgs e)
{
SqlDataSource sds1= new SqlDataSource();
sds1.ID = "sds1";
this.Controls.Add(sds1);
sds1.ConnectionString = ConfigurationManager.ConnectionStrings["my_conn_str"].ToString();
}
}
}
No comments:
Post a Comment