开发者

how to connect to Oracle 11g database using Asp.Net

开发者 https://www.devze.com 2023-01-31 14:35 出处:网络
How 开发者_如何学Cdo I connect to an Oracle 11g database using asp.net3.5? what is the name space and how to write connection string in web.config file?

How 开发者_如何学Cdo I connect to an Oracle 11g database using asp.net3.5?

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

please help me..


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.

Namespaces:

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.

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

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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号