资源简介

c#源码,访问access数据库,查询表内数据。查询语句返回datatable,在dataGridView上面显示

资源截图

代码片段和文件信息

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.OleDb;

namespace SelectAccess
{
    public partial class Form1 : Form
    {
        OleDbConnection Connection;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender EventArgs e)
        {

        }

        private void button1_Click(object sender EventArgs e)
        {
            DataTable dt = ReturnDataSet(“select * from 测试“).Tables[0];
            dataGridView1.DataSource = dt;
        }
        public DataSet ReturnDataSet(string strSQL)
        {
            string connStr = @“P

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    1282048  2018-12-05 16:12  SelectAccess\SelectAccess\bin\Debug\BZH.MDB

     文件       9216  2018-12-05 16:12  SelectAccess\SelectAccess\bin\Debug\SelectAccess.exe

     文件      24064  2018-12-05 16:12  SelectAccess\SelectAccess\bin\Debug\SelectAccess.pdb

     文件      14848  2018-12-05 16:12  SelectAccess\SelectAccess\bin\Debug\SelectAccess.vshost.exe

     文件        490  2009-06-11 05:14  SelectAccess\SelectAccess\bin\Debug\SelectAccess.vshost.exe.manifest

     文件       1502  2018-12-05 16:12  SelectAccess\SelectAccess\Form1.cs

     文件       2985  2018-12-05 16:10  SelectAccess\SelectAccess\Form1.Designer.cs

     文件       5814  2018-12-05 16:10  SelectAccess\SelectAccess\Form1.resx

     文件        655  2018-12-05 16:12  SelectAccess\SelectAccess\obj\Debug\SelectAccess.csproj.FileListAbsolute.txt

     文件        847  2018-12-05 16:10  SelectAccess\SelectAccess\obj\Debug\SelectAccess.csproj.GenerateResource.Cache

     文件       9216  2018-12-05 16:12  SelectAccess\SelectAccess\obj\Debug\SelectAccess.exe

     文件        180  2018-12-05 16:11  SelectAccess\SelectAccess\obj\Debug\SelectAccess.Form1.resources

     文件      24064  2018-12-05 16:12  SelectAccess\SelectAccess\obj\Debug\SelectAccess.pdb

     文件        180  2018-12-05 16:11  SelectAccess\SelectAccess\obj\Debug\SelectAccess.Properties.Resources.resources

     文件        493  2018-12-05 16:02  SelectAccess\SelectAccess\Program.cs

     文件       1374  2018-12-05 16:02  SelectAccess\SelectAccess\Properties\AssemblyInfo.cs

     文件       2874  2018-12-05 16:02  SelectAccess\SelectAccess\Properties\Resources.Designer.cs

     文件       5612  2018-12-05 16:02  SelectAccess\SelectAccess\Properties\Resources.resx

     文件       1097  2018-12-05 16:02  SelectAccess\SelectAccess\Properties\Settings.Designer.cs

     文件        249  2018-12-05 16:02  SelectAccess\SelectAccess\Properties\Settings.settings

     文件       3777  2018-12-05 16:11  SelectAccess\SelectAccess\SelectAccess.csproj

     文件        926  2018-12-05 16:02  SelectAccess\SelectAccess.sln

    ..A..H.     15872  2018-12-05 16:12  SelectAccess\SelectAccess.suo

     目录          0  2018-12-05 16:02  SelectAccess\SelectAccess\obj\Debug\TempPE

     目录          0  2018-12-05 16:13  SelectAccess\SelectAccess\bin\Debug

     目录          0  2018-12-05 16:13  SelectAccess\SelectAccess\obj\Debug

     目录          0  2018-12-05 16:13  SelectAccess\SelectAccess\bin

     目录          0  2018-12-05 16:13  SelectAccess\SelectAccess\obj

     目录          0  2018-12-05 16:13  SelectAccess\SelectAccess\Properties

     目录          0  2018-12-05 16:13  SelectAccess\SelectAccess

............此处省略4个文件信息

评论

共有 条评论