help
I am getting this Exception:
System.InvalidOperationException: The ConnectionString property has not been initialized.
code:
private void bindData()
{
dbcon objDbCon=new dbcon();
DataSet ds=new DataSet();
string sql;
if (ViewState["sortfield"]!=null)
sql="select * from [product details] where category_id=" + catid + " order by " + ViewState["sortfield"].ToString();
else
sql="select * from [product details] where category_id=" + catid;
objDbCon.getData(sql, ref ds,"[product details]");
objDbCon.dispose();
objDbCon=null;
if (ds.Tables["[product details]"].Rows.Count>0)
{
grdItemlist.DataSource=ds;
grdItemlist.DataMember="[product details]";
grdItemlist.PageSize=5;
grdItemlist.DataBind();
}
else
{
Errmsg.Text="No items in this category";
}
}
|