A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© aisini 金牌黑马   /  2014-7-30 11:43  /  806 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Data.OracleClient;

  9. namespace WindowsFormsApplication3
  10. {
  11.     public partial class Form1 : Form
  12.     {
  13.         public Form1()
  14.         {
  15.             InitializeComponent();
  16.         }

  17.         private void button1_Click(object sender, EventArgs e)
  18.         {
  19.             button1.Enabled = false;
  20.             int abc = 0;
  21.             try
  22.             {
  23.                 for (int i = 0; i < 1000; i++)
  24.                 {
  25.                     abc = i;
  26.                     OracleConnection connection = new OracleConnection("Data Source=ORCL;Persist Security Info=True;User ID=ZMZXSYS;Password=admin;Unicode=True");
  27.                     connection.Open();
  28.                 }
  29.                 MessageBox.Show("数据库连接数大于:" + abc.ToString());
  30.             }
  31.             catch (Exception err)
  32.             {
  33.                 this.Text = abc.ToString();
  34.                 MessageBox.Show("数据库连接最大数为:"+ abc.ToString());
  35.                 //throw (err);
  36.             }


  37.             button1.Enabled = true;
  38.         }
  39.     }
  40. }
复制代码



0 个回复

您需要登录后才可以回帖 登录 | 加入黑马