• 步步为营-37-自动生成数据库连接字符串


    说明:propertyGrid的使用 ,其中涉及到一个复制到粘贴版功能

    1:先建立UI界面

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace 数据库连接字符串生成
    {
        public partial class Form2 : Form
        {
            public Form2()
            {
                InitializeComponent();
                SqlConnectionStringBuilder scsb = new SqlConnectionStringBuilder();
                scsb.UserID = "sa";
                scsb.DataSource = ".";
                this.propertyGrid1.SelectedObject = scsb;
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                string str = this.propertyGrid1.SelectedObject.ToString();
                //粘贴板
                Clipboard.Clear();
                Clipboard.SetText(str);
                MessageBox.Show(str);
            }
        }
    }
    View Code

    2:运行结果

  • 相关阅读:
    poj2975(nim游戏取法)
    hdu5785(极角排序求所有锐角钝角个数)
    hdu5787(数位dp)
    划分树模板
    Struts配置文件
    Struts2 调用非execute方法
    Struts简单的实例
    Struts简介
    linux yum 命令
    Linux vi/vim
  • 原文地址:https://www.cnblogs.com/YK2012/p/6765172.html
Copyright © 2020-2023  润新知