google搜索 51Testing站内搜索                    软件测试门户 | 软件测试培 训 | 文章资料精选 | 软件测试论坛 | 软件测试博客 | 测试招聘求职 
打印

有没有人遇到过"未将对象引用设置到对象的实例。"的问题啊?

有没有人遇到过"未将对象引用设置到对象的实例。"的问题啊?


我在用NUnit软件测试代码时,出现"Buggit.BizRule.Testing.TestValue.TestInsert2 : System.NullReferenceException : 未将对象引用设置到对象的实例。"这种错误,而且是连续出现同样的错误,有谁遇到过解决的啊?我将代码也看了好几遍,没有看出什么错误来sdlkfj8 ,代码如下:
[Test]
//                [ExpectedException(typeof(Exception))]
                public void TestInsert2()
                {
                        TValue m_Value = new TValue();
                        DataTable table = m_Value.dataSet.Tables[TValue.TABLENAME];
                        DataRow row = table.NewRow();
//
//                        DataSet ds=new TValue();
//                        DataRow dr= new DataRow();
                        row[TValue.CODE_FIELD]="23";
                        row[TValue.VALUE_FIELD]="分配";
                        row[TValue.TYPE_FIELD]="Bug严重性参数";
                        row[TValue.EVALUE_FIELD]="assigned";
                        table.Rows.Add(row);
                        int i=control.InsertValue(m_Value.dataSet);
        //                Values va=new Values();
                        TValue v=new TValue();
                        v=control.GetValuesByCode("23");
                        Assert.AreEqual("分配",v.dataSet.Tables[0].Rows[0][TValue.VALUE_FIELD].ToString());
                }

请指教~~
I have to have my life goal,or I will die! Set life goal for myself,summon up, in pursuit of the goal to find myself!

TOP

http://bbs.51testing.com/viewthr ... 3%B5%C4%CA%B5%C0%FD

先参考一下看看能不能解决问题
新手必读:论坛积分制度

TOP

我知道了,是由于数据库中连接问题,谢谢斑竹sdlkfj5
I have to have my life goal,or I will die! Set life goal for myself,summon up, in pursuit of the goal to find myself!

TOP

 
当前时区 GMT+8, 现在时间是 2008-9-7 03:51Copyright(C)上海博为峰软件技术有限公司 2001-2007 电话:021-64471599-8017
当您在访问网站、论坛及博客过程中遇到问题时可发送email:webmaster@51testing.com或发送论坛短信至管理员风在吹