上面这个代码错了,下面的能运行,但是达不到效果?为什么
OleDbConnection conn=new OleDbConnection();
conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"+"Data Source="+Server.MapPath(@"\hpuedu\hpuwebdata\webdata.mdb");
conn.Open();
int myID=Convert.ToInt32(Request["ID"]);
string strsql="select newsImg from hotNews where ID like '"+myID+"'";
OleDbDataAdapter da=new OleDbDataAdapter(strsql,conn);
if(strsql=="")
{
this.DataList1.Visible=false;
}
else
{
DataSet ds=new DataSet();
da.Fill(ds,"DataList1");
this.DataList1.DataSource=ds.Tables["DataList1"].DefaultView;
this.DataList1.DataBind();
conn.Close();
}