当前位置:编程学习 > C#/ASP.NET >>

未将对象引用设置岛对象的实例

啥也不说了,直接上代码,提示错误信息:未将对象引用设置岛对象的实例,
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
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,