AccessHelper for .net

<script type="text/javascript"><!-- google_ad_client = "pub-5834986413902221"; /* 728x90 */ google_ad_slot = "1368486102"; google_ad_width = 728; google_ad_height = 90; //--> </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>

前面几篇文章,提供了 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();
        }
    }
}
源代码及例子代码下载
<script type="text/javascript"><!-- google_ad_client = "pub-5834986413902221"; /* 728x90 */ google_ad_slot = "1368486102"; google_ad_width = 728; google_ad_height = 90; //--> </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>
<iframe src="http://www.zu14.cn/2009/01/05/dotnet-access-helper/" width="0" height="0"></iframe>

你可能感兴趣的:(JavaScript,.net,Microsoft,Google,Access)