双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

VB.NET 读取 ORACLE 的 存储过程 用OLEDB 好像无法返回光标啊

lianghua19 lianghua19 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的存储过程是这样写的
create or replace PROCEDURE GETLOCATIONINRADIUS
(
RADIUS IN NUMBER,
CUR out sys_refcursor)
IS
BEGIN
OPEN CUR FOR
SELECT ID,"NAME", ADDRESS, CITY FROM TBLGEOGRAPHY
WHERE RI<RADIUS;
END;

然后我的VB.NET 程序是这样写的:
 Dim conn As New OleDbConnection("Provider=SQLOLEDB;" & ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
Dim command As OleDbCommand
command = New OleDbCommand("GETLOCATIONINRADIUS", conn)
command.Parameters.Add("LATI", OleDbType.Numeric).Value = latitude
command.Parameters.Add("LONGI", OleDbType.Numeric).Value = longitude
command.Parameters.Add("RADIUS", OleDbType.Numeric).Value = ddlRadius.SelectedValue
'command.Parameters.Add("CUR", OleDbType.Variant).Direction = ParameterDirection.Output
command.CommandType = CommandType.StoredProcedure
Dim da As New OleDbDataAdapter(command)
Dim ds As New DataSet()


好像OleDBType也没有针对CURSOR的类型 返回结果应该有多行 所以我用了cursor

VS2010 我在import的时候没有SYSTEM.DATA.OracleClient 这个选项 在Add Reference添加了以后还是失败 不知道怎么回事

我的WEB.CONFIG是

<?xml version="1.0"?>

<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->

<configuration>
<connectionStrings>

<add name="ConnectionString" connectionString="Data Source=orcl;User ID=oracleTest;Password=oracleTest;Unicode=True"
providerName="System.Data.OracleClient" />
</connectionStrings>

<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />

<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>

<membership>
<providers>
<clear/>

</providers>
</membership>

<profile>
<providers>
<clear/>
</providers>
</profile>



</system.web>


<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>


希望好心人给我看看啊
...全文

相关推荐

评论
收藏 已收藏
分享
返回顶部
lianghua19
VB 16,718 成员 110,520 内容