自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

C#連接Oracle數(shù)據(jù)庫查詢數(shù)據(jù)

數(shù)據(jù)庫 Oracle
Oracle數(shù)據(jù)庫中可以運(yùn)行C#的確方便了我們的開發(fā)過程,下面就教您C#連接Oracle數(shù)據(jù)庫查詢數(shù)據(jù)的實(shí)現(xiàn)方法,供您參考學(xué)習(xí)。

C#連接Oracle數(shù)據(jù)庫可以實(shí)現(xiàn)許多我們需要的功能,下面介紹的是C#連接Oracle數(shù)據(jù)庫查詢數(shù)據(jù)的方法,如果您對(duì)C#連接Oracle數(shù)據(jù)庫方面感興趣的話,不妨一看。

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel  
  4. using System.Data.OracleClient;;//這行和下一行都要先在引用中填加system.data.oracleclient  
  5. using System.Data;  
  6. using System.Drawing;  
  7. using System.Text;  
  8. using System.Windows.Forms;  
  9.  
  10. namespace WindowsApplication1  
  11. {  
  12.     public partial class Form1 : Form  
  13.     {  
  14.         public Form1()  
  15.         {  
  16.             InitializeComponent();  
  17.         }  
  18.           
  19.         private void button1_Click(object sender, EventArgs e)  
  20.         {  
  21.             #region 從region到endregion是手工寫的。別的都是系統(tǒng)自動(dòng)生成的  
  22.             string constring = "data source=wzd;user=wzd;password=wzd;";//定義連接數(shù)據(jù)庫的字符串  
  23.             OracleConnection conn = new OracleConnection(constring);//進(jìn)行連接  
  24.             try  
  25.             {  
  26.                 conn.Open();//打開指定的連接  
  27.                 OracleCommand com = conn.CreateCommand();  
  28.                 com.CommandText = "select name from mytable where card_no='0000000002'";//寫好想執(zhí)行的Sql語句  
  29.                 OracleDataReader odr = com.ExecuteReader();  
  30.                 while (odr.Read())//讀取數(shù)據(jù),如果返回為false的話,就說明到記錄集的尾部了  
  31.  
  32.                 {  
  33.                     this.lbl.Text = odr.GetOracleString(0).ToString();//將讀取到的值顯示到定義的控件中。  
  34.                 }  
  35.                 odr.Close();//關(guān)閉reader.這是一定要寫的  
  36.             }  
  37.             catch  
  38.             {  
  39.                 MessageBox.Show("erro");//如果發(fā)生異常,則提示出錯(cuò)  
  40.             }  
  41.             finally  
  42.             {  
  43.                 conn.Close();//關(guān)閉打開的連接  
  44.             }  
  45.  
  46.             #endregion  
  47.         }  
  48.     }  
  49. }  
  50.  

 

 

 

 

【編輯推薦】

使用oracle存儲(chǔ)過程分頁的實(shí)例

oracle RMAN備份的優(yōu)化

帶您了解Oracle OS備份

Oracle EXP/IMP備份簡(jiǎn)介

Oracle數(shù)據(jù)庫備份的重要性

責(zé)任編輯:段燃 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-10-26 15:30:12

連接Oracle數(shù)據(jù)庫

2009-08-20 17:55:43

C#連接Oracle數(shù)

2011-07-12 14:08:48

OracleODAC

2009-08-24 18:09:13

C#調(diào)用Oracle數(shù)

2009-03-19 10:08:09

C#數(shù)據(jù)庫查詢

2009-08-25 15:35:20

C#連接Oracle數(shù)

2009-09-04 17:23:21

C#數(shù)據(jù)庫連接對(duì)象

2009-08-25 14:05:06

C#連接數(shù)據(jù)庫代碼

2009-08-03 14:17:18

C#連接AccessC#連接SQL Ser

2009-08-07 14:02:12

C#數(shù)據(jù)庫連接字符串

2009-08-12 14:23:01

C#連接MySql數(shù)據(jù)

2009-08-25 15:50:13

C#連接遠(yuǎn)程數(shù)據(jù)庫

2009-09-04 17:49:34

C#連接數(shù)據(jù)庫

2009-08-10 18:05:19

C#數(shù)據(jù)庫查詢

2009-08-25 14:18:13

C#如何連接數(shù)據(jù)庫

2009-08-18 11:23:11

2010-05-14 09:08:10

C#Oracle

2024-04-03 00:06:03

2009-08-11 13:35:13

C# Berkeley

2012-07-23 14:30:33

Oracle
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)