AccessHelper for .net

本文介绍了一个名为AccessHelper的工具类,该类用于在.NET应用程序中操作Microsoft Access数据库。文章通过示例代码展示了如何使用AccessHelper执行SQL查询并获取结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<noscript type="text/javascript"> </noscript> <noscript src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </noscript>

前面几篇文章,提供了 sqlhelperoledbhelper 给大家共享,这次,提供一个accesshelper,和oledbhelper基本类似,但是稍微有些差别, 使用方式和SqlHelper一致。

using System;
using System.Data;
using System.Data.OleDb;
using Access.ApplicationBlocks.Data;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            using (OleDbDataReader dr = AccessHelper.ExecuteReader(
                "Provider=Microsoft.Jet.OleDb.4.0;Data Source=d:\test.mdb", 
                CommandType.Text, 
                "SELECT [field] FROM [tablename]"))
            {
                while (dr.Read())
                {
                    Console.WriteLine(dr.GetString(0));
                }
            }

            Console.Read();
        }
    }
}
源代码及例子代码下载
<noscript type="text/javascript"> </noscript> <noscript src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </noscript>
<iframe src="http://www.zu14.cn/2009/01/05/dotnet-access-helper/" width="0" height="0"></iframe>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值