|
请教个问题:
通过下面这个函数
public int Insert(string jobcode,string jobname)
{
string strSql=string.Empty;
strSql="insert into CDC_PROFESSION( JOBCODE,JOBNAME) values ('"
+jobcode
+"',"
+jobname
+"')";
int ret=0;
DataAccess.Instance.Execute(strSql,out ret);
return ret;
}
我写的下面的测试代码如下:
using System;
using NUnit.Framework;
using CDCBussiness.BaseInfo;
namespace cdc_test
{
/// <summary>
/// 插入没有起始日期的情况
/// </summary>
[TestFixture]
public class Profession_test
{
Profession pro = new Profession();
[Test]
public void Insert_test()
{
int ret = pro.Insert("1111","lose job");
Assert.AreEqual(0,ret);
Console.WriteLine("ok");
}
}
}
在NUNIT中运行后有如下出错提示:
at CDCSystem.SystemConfig.GetSettings() in E:\cdc\CDCSystem\Config.cs:line 22
at CDCData.DataBase.OracleHelper.get_ConnectionString() in E:\cdc\CDCData\DataBase\OracleHelper.cs:line 44
at CDCData.DataBase.OracleHelper.Execute(String strSql, Int32& ret) in E:\cdc\CDCData\DataBase\OracleHelper.cs:line 2324
at CDCBussiness.BaseInfo.Profession.Insert(String jobcode, String jobname) in E:\cdc\CDCBussiness\BaseInfo\Profession.cs:line 40
at cdc_test.Profession_test.Insert_test() in e:\cdc\cdc_test\class1.cs:line 18
请问这是什么原因?谢谢 |
|