- 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;
-
- namespace WindowsFormsApplication3
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- button1.Enabled = false;
- int abc = 0;
- try
- {
- for (int i = 0; i < 1000; i++)
- {
- abc = i;
- OracleConnection connection = new OracleConnection("Data Source=ORCL;Persist Security Info=True;User ID=ZMZXSYS;Password=admin;Unicode=True");
- connection.Open();
- }
- MessageBox.Show("数据库连接数大于:" + abc.ToString());
- }
- catch (Exception err)
- {
- this.Text = abc.ToString();
- MessageBox.Show("数据库连接最大数为:"+ abc.ToString());
- //throw (err);
- }
-
-
- button1.Enabled = true;
- }
- }
- }
复制代码
|
|