当前位置:首页 > 开发 > 编程语言 > .NET > 正文

.NET 连接oracle

发表于: 2011-05-11   作者:ctrain   来源:转载   浏览次数:
摘要: using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OracleClient;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void add_record_Click(object sender, EventArgs e)
    {
        string strSTOREROOM_ID = this.STOREROOM_ID.Text.Trim();
        string strSTOREROOM_LOCATION = this.STOREROOM_LOCATION.Text.Trim();
        string strSTOREROOM_HIGHTEMPERATURE = this.STOREROOM_HIGHTEMPERATURE.Text.Trim();
        string strSTOREROOM_LOWTEMPERATURE = this.STOREROOM_LOWTEMPERATURE.Text.Trim();
        string strSTOREROOM_HIGHHUMIDITY = this.STOREROOM_HIGHHUMIDITY.Text.Trim();
        string strSTOREROOM_LOWHUMIDITY = this.STOREROOM_LOWHUMIDITY.Text.Trim();

        string connestr = "Data Source=ORCL;Persist Security Info=True;User ID=EIPAPP;Password=eipapp;Unicode=True";
        OracleConnection connection = new OracleConnection(connestr);
        OracleCommand command = new OracleCommand();
        string insertstr = "insert into T_STOREROOM_STAKEOUT "+
"(STOREROOM_ID,STOREROOM_LOCATION,STOREROOM_HIGHTEMPERATURE,STOREROOM_LOWTEMPERATURE,STOREROOM_HIGHHUMIDITY,STOREROOM_LOWHUMIDITY) "+
            "values(" + Convert.ToInt32(strSTOREROOM_ID) + ",'" + 
             strSTOREROOM_LOCATION.ToString() + "'," +
             Convert.ToInt32(strSTOREROOM_HIGHTEMPERATURE) + "," +
             Convert.ToInt32(strSTOREROOM_LOWTEMPERATURE) + "," +
             Convert.ToInt32(strSTOREROOM_HIGHHUMIDITY) + "," +
             Convert.ToInt32(strSTOREROOM_LOWHUMIDITY) + ")";
        command.Connection = connection;
        command.CommandText = insertstr;
        command.Connection.Open();
        command.ExecuteNonQuery();

        Response.Redirect("Default.aspx");

    }
}

 

 

 

.NET 连接oracle

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

编辑推荐
1:首先在web配置文件对连接字符串进行配置 <connectionStrings> <add name="conStr" conn
用客户端连入Oracle服务器的主要方法。从组件相关方角度看,Oracle Net连接过程涉及到很多的技术和
这里需要注意的是 OleDbConnection 对 Clob 之类的 Oracle 9i 的数据类型不支持,必须使用 OracleCo
安装好Oracle和pl/sql后,用pl/sql连接Oracle报错弹窗, 报错内容: “SQL*Net not properly instal
安装好Oracle和pl/sql后,用pl/sql连接Oracle报错弹窗, 报错内容: “SQL*Net not properly instal
==================== 内连接 ==================== 内链接实际上就是利用where子句对两张表形成的
在做数据提取的时候发现一个非常奇怪的问题。 Oracle客户端是安装正确并且Toad可以正常运行的,但是
首先,进入 oracle 管理 找到 TNS 描述符,然后,复制下来。 进入 asp.net 项目,打开 web.config &
dotConnect for Oracle完全基于ADO.NET方法,因此您完全可以采用标准ADO.NET数据提供的方法来使用它
SELECT * FROM SCOTT.EMP T1, SCOTT.EMP T2 WHERE T1.MGR = T2.EMPNO(+) ORDER BY T2.EMPNO;
版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号