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

lianghua19 2012-09-21 11:54:01
我的存储过程是这样写的
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>


希望好心人给我看看啊
...全文
225 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧