zoukankan      html  css  js  c++  java
  • oracle 测试代码

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Globalization;
    using System.Runtime.InteropServices;
    using Oracle.DataAccess;


    namespace testjpcn
    {
      
        public partial class Form1 : Form
        {
            [DllImport("kernel32.dll", SetLastError = true)]
            static extern int GetThreadLocale();
            public Form1()
            {
                InitializeComponent();
            }

            private void button1_Click(object sender, EventArgs e)
            {
                Oracle.DataAccess.Client.OracleConnection ocn = new Oracle.DataAccess.Client.OracleConnection();
                ocn.ConnectionString = "User Id=System;Password =oracle;Data Source=ujpcn";
                ocn.Open();
                Oracle.DataAccess.Client.OracleCommand ocmd = new Oracle.DataAccess.Client.OracleCommand();
                ocmd.CommandText = "INSERT INTO TEST (ID,MEMO) VALUES('" + System.DateTime.Now.ToLongTimeString() + "','" + textBox1.Text+"')";
                 
                ocmd.Connection = ocn;
                ocmd.ExecuteNonQuery();

                Oracle.DataAccess.Client.OracleDataAdapter odp = new Oracle.DataAccess.Client.OracleDataAdapter();
                DataSet ds = new DataSet();
                Oracle.DataAccess.Client.OracleCommand ocmd1 = new Oracle.DataAccess.Client.OracleCommand();
                ocmd1.CommandText = "select * from test";
                ocmd1.Connection = ocn;
                odp.SelectCommand = ocmd1;
                odp.Fill(ds);
                this.dataGridView1.DataSource = ds.Tables[0];
            
            }

            private void Form1_Load(object sender, EventArgs e)
            {
                CultureInfo cInfo = CultureInfo.GetCultureInfo(GetThreadLocale());
                this.label2.Text = cInfo.CompareInfo.Name.ToString();

                Oracle.DataAccess.Client.OracleConnection ocn = new Oracle.DataAccess.Client.OracleConnection();
                ocn.ConnectionString = "User Id=System;Password =oracle;Data Source=ujpcn";
                ocn.Open();
                Oracle.DataAccess.Client.OracleCommand ocmd= new Oracle.DataAccess.Client.OracleCommand();
                ocmd.CommandText = "select * from test";
                ocmd.Connection = ocn;
                Oracle.DataAccess.Client.OracleDataAdapter odp = new Oracle.DataAccess.Client.OracleDataAdapter();
                
                DataSet ds = new DataSet();
                odp.SelectCommand = ocmd;
     
                odp.Fill(ds);
                this.dataGridView1.DataSource = ds.Tables[0]; 
               
               
            }
        }
    }

  • 相关阅读:
    MATLAB01
    Diffie-Hellman 密钥交换
    古典密码
    正则表达式
    装饰器初析
    进制转换的栈实现
    Log4j(异常日志)
    2018/6/6
    2018.1.1T19B3-u4
    2018.1.1T19-B3-U3jiangyi
  • 原文地址:https://www.cnblogs.com/Alvin/p/1624008.html
Copyright © 2011-2022 走看看