- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Data.OracleClient; //引用的组件
- using System.Collections;
- using System.IO;
- namespace WindowsFormsApplication7
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- string str = "Password=gtis_pm" + ";Persist Security Info=True;User ID=gtis_pm" + ";Data Source=egov_192.168.1.131;";
- IDbConnection conn = new OracleConnection(str);
- conn.Open();
- IDbCommand com = conn.CreateCommand();
- com.CommandText = "select * from PM_MANAGER_INFO ";
- IDataReader read = com.ExecuteReader();
- while (read.Read())
- {
- listBox1.Items.Add(read[1].ToString() + " " + read[4].ToString());
- }
- }
- catch (Exception eex)
- {
- MessageBox.Show(eex.Message.ToString());
- }
- finally
- {
- }
- }
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/0109201513603.html
来源: http://www.codesnippet.cn/detail/0109201513603.html