protected void Page_Load(object sender, EventArgs e)
{
string query = "SELECT Posts.*, Import_Export.* FROM Import_Export INNER JOIN Posts ON Import_Export.CatID = Posts.CatID where Import_Export.Parent=@Parent ";
if (Request.QueryString["CID"] != null)
{
query += " and Import_Export.CatID=@CatID";
SqlDataSource2.SelectCommand = query;
SqlDataSource2.SelectParameters["Parent"].DefaultValue = Request.QueryString["Type"].ToString();
SqlDataSource2.SelectParameters["CatID"].DefaultValue = Request.QueryString["CID"].ToString();
}
else
{
SqlDataSource2.SelectCommand = query;
SqlDataSource2.SelectParameters["Parent"].DefaultValue = Request.QueryString["Type"].ToString();
}
}
嗨
,我写了这段代码,当我运行这段代码时,发生了以下错误:
对象引用未设置为对象的实例。
为什么?