using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace _11_链接字符串构造
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
SqlConnectionStringBuilder scsb=(SqlConnectionStringBuilder)propertyGrid1.SelectedObject;
MessageBox.Show(scsb.ConnectionString.ToString());
}
private void button1_Click(object sender, EventArgs e)
{
SqlConnectionStringBuilder scsb = new SqlConnectionStringBuilder(); //定义一个字符串,连接字符串构造者
propertyGrid1.SelectedObject = scsb;
}
}
}