数据库查询时如何判断字段为不为空!!
数据库查询时如何判断该字段为不为空!!以下代码老提示错误-------"没有找到行/列数据"什么原因呢?
OleDbConnection conn=new OleDbConnection();
conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"+"Data Source="+Server.MapPath(@"\hpuedu\hpuwebdata\webdata.mdb");
string myID=Request["ID"].ToString();
OleDbCommand cmd=new OleDbCommand("select ID,n_Content from hotNews where ID like '"+myID+"'",conn);
conn.Open();
OleDbDataReader sdr=cmd.ExecuteReader();
if( sdr["n_Content"]!=System.DBNull.Value)
{
//to do
}
else
{
//null
}