未将对象引用设置岛对象的实例
啥也不说了,直接上代码,提示错误信息:未将对象引用设置岛对象的实例,public class abcdb
{
public static OleDbDataReader dataReader(string sqlstr)
{
OleDbDataReader dr = null;
try
{
openConnection();
comm.CommandText = sqlstr;
comm.CommandType = CommandType.Text;
dr = comm.ExecuteReader(CommandBehavior.CloseConnection);
}
catch
{
try
{
dr.Close();
closeConnection();
}
catch ()
{
}
}
return dr;
}
}
OleDbDataReader odr;
odr = abcdb.dataReader("select * from [dbname] where abname='" + abname+ "'");
if (odr.Read())
{
Response.Write("成功");
}
else
{
Response.Write("失败");
}
补充:.NET技术 , ASP.NET