今天用了一下oracle,写了个语句不知道怎么获取结果,各位帮忙看看:
string strCommand = "
begin declare t number(6); begin insert into DepartmentAnnounce(id,Title,Content) values(Departmentannounce_Sequence.nextval,:Title); select Departmentannounce_Sequence.currval into t from dual; end;end;";那个into t是后加上去的,不太明白为什么一定要这个into clause?
本以为这样可以返回结果:
con = new OracleConnection(connectionString);
con.Open();
OracleCommand command = new OracleCommand(context, con);
add(command);//一个委托,用于添加参数的
return command.ExecuteOracleScalar();
可是结果为0.
各位看看哪里有问题呢?应该怎样做才能得到那个值(t)?谢谢了!
string strCommand = "
begin declare t number(6); begin insert into DepartmentAnnounce(id,Title,Content) values(Departmentannounce_Sequence.nextval,:Title); select Departmentannounce_Sequence.currval into t from dual; end;end;";那个into t是后加上去的,不太明白为什么一定要这个into clause?
本以为这样可以返回结果:
con = new OracleConnection(connectionString);
con.Open();
OracleCommand command = new OracleCommand(context, con);
add(command);//一个委托,用于添加参数的
return command.ExecuteOracleScalar();
可是结果为0.
各位看看哪里有问题呢?应该怎样做才能得到那个值(t)?谢谢了!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货