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 Ex04_5
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                string ConStr = "server=(local);user id=myzf;pwd=123456;database=MysqlData";
                SqlConnection con = new SqlConnection(ConStr);
                string SqlStr = "select * from 应付账";
                SqlDataAdapter ada = new SqlDataAdapter(SqlStr, con);
                DataSet ds = new DataSet();
                ada.Fill(ds);
                this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            catch
            {
                return;
            }
        }
    }
}
