scholastic/Form6_1_1.cs

(完整代码) 989B

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.Windows.Forms;

namespace scholastic
{
    public partial class Form6_1_1 : Form
    {
        public Form6_1_1()
        {
            InitializeComponent();
        }

        private void Form6_1_1_Load(object sender, EventArgs e)
        {
            string constr = "server=.\\sql2005;database=mydata;uid=sa;pwd=sa";
            SqlConnection mycon = new SqlConnection(constr);
            string mysql = "select * from class";
            SqlDataAdapter myada = new SqlDataAdapter(mysql, mycon);
            DataSet myds = new DataSet();
            myada.Fill(myds);
            dataGridView1.DataSource = myds.Tables[0].DefaultView;    //连接数据表格,显示数据
            mycon.Close();
            mycon.Dispose();
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。