如何使用Asp.Net连接到Oracle 11g数据库 [英] how to connect to Oracle 11g database using Asp.Net

查看:300
本文介绍了如何使用Asp.Net连接到Oracle 11g数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用ASP.NET3.5连接到Oracle 11g数据库?

How do I connect to an Oracle 11g database using asp.net3.5?

什么是命名空间以及如何编写连接字符串中的web.config文件?

what is the name space and how to write connection string in web.config file?

请帮助我..

推荐答案

这取决于数据提供者。请参阅: ConnectionString.com 也许更具体:的 .NET数据提供程序的Oracle 。连接字符串应该在你的web.config文件非常相似。唯一的区别,obiously,将是系统/数据库名称(S),用户ID,PWD等。

It depends on the data provider. See: ConnectionString.com And perhaps more specifically: The .NET Data Provider for Oracle. The connection string should look very similar in your web.config file. The only differences, obiously, will be the system/db name(s), user id, pwd etc.

命名空间

,有必要知道哪种类型的
  对象可以具有相同的名称和
  哪些不是。为此,它是
  需要引入的概念
  命名空间。命名空间定义
  组对象类型,其内
  所有名称必须是唯一
  确定按模式和名称。对象
  在不同的命名空间可以共享
  相同的名称。

it is necessary to know which type of objects can have the same name and which are not. For this it is necessary to introduce the concept of a namespace. A namespace defines a group of object types, within which all names must be uniquely identified—by schema and name. Objects in different namespaces can share the same name.

下面也href=\"http://www.$c$cguru.com/csharp/.net/net_asp/tutorials/article.php/c8477/\" rel=\"nofollow\">好的教程<一个你可以按照那是ASP.NET特有的。和另一篇文章可能会感兴趣的。

Here's also a nice tutorial you can follow that is ASP.NET-specific. And another article that may be of interest.

和一个code段(使用.NET Oracle提供:)

And a code snippet (using .NET Oracle provider:)

public DataTable myDataTable(string SQL, string ConnStr)
{
    OracleConnection cn = default(OracleConnection);
    DataSet dsTemp = null;
    OracleDataAdapter dsCmd = default(OracleDataAdapter);

    cn = new OracleConnection(ConnStr);
    cn.Open();

    dsCmd = new OracleDataAdapter(SQL, cn);
    dsTemp = new DataSet();
    dsCmd.Fill(dsTemp, "myQuery");
    cn.Close();
    return dsTemp.Tables[0];
}

这篇关于如何使用Asp.Net连接到Oracle 11g数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆