asp.net 如何连接oracle数据库?

wwyf 2003-08-04 02:03:45
asp.net 如何连接oracle数据库?
请问:
为什么我在.net中编写xxx.aspx时,输入如 <form 时代码专家
没有任何提示?如action 之类???
又如win2000,oracle8 我连接数据库时
代码:
<%@ page Language=VBScript debug=true %>
<%@ import namespace="system.data" %>
<%@ import namespace="system.data.oledb" %>
<script runat=server>
sub page_load(byval sender as object ,byval e as eventargs)
dim dbconn as oledbconnection
dim dbsql as new oledbcommand
dbconn=new oledbconnection("Provider=MSDAORA.1;Password=good;User ID=ff;Data Source=fly")
dbsql.commandtext="select * from users"
dbsql.connection=dbconn
dbsql.connection.open
dbsql.executenonquery()
end sub
</script>
/////////////////////////////
则出现错误提示:
Oracle client and networking components were not found.
These components are supplied by Oracle Corporation
and are part of the Oracle Version 7.3.3 or later client software installation.
Provider is unable to function until these components are installed.
如何处理??
谢谢!!!

...全文
96 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
panyee 2003-08-04
  • 打赏
  • 举报
回复
要访问其它机器的oracle数据库, 要安装oracle客户端, 并配置一个oracle实例

Provider=MSDAORA.1;Password=good;User ID=ff;Data Source=fly"

你的Data Source是fly, 但你要用net 8 config看一下有没有配置了这个实例
没有的话就连不上
oracle不一定提供机器名即实例名的默认实例
wayneliu 2003-08-04
  • 打赏
  • 举报
回复
public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText)
{
//pass through the call providing null for the set of SqlParameters
return ExecuteNonQuery(connectionString, commandType, commandText, (SqlParameter[])null);
}

public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
{
//create & open a SqlConnection, and dispose of it after we are done.
using (SqlConnection cn = new SqlConnection(connectionString))
{
cn.Open();

//call the overload that takes a connection in place of the connection string
return ExecuteNonQuery(cn, commandType, commandText, commandParameters);
}
}
public static int ExecuteNonQuery(string connectionString, string spName, params object[] parameterValues)
{
//if we receive parameter values, we need to figure out where they go
if ((parameterValues != null) && (parameterValues.Length > 0))
{
//pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache)
SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);

//assign the provided values to these parameters based on parameter order
AssignParameterValues(commandParameters, parameterValues);

//call the overload that takes an array of SqlParameters
return ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName, commandParameters);
}
//otherwise we can just call the SP without params
else
{
return ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName);
}
}
tclzbz 2003-08-04
  • 打赏
  • 举报
回复
问题解决了吗?
edobnet 2003-08-04
  • 打赏
  • 举报
回复
装一下Oracle客户端试试

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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