<connectionStrings>
<add name="connStr" connectionString="server=.;uid=home;pwd=;database=EFFristModel"/>
<!--<add name="connStr" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|EFFristModel.mdb" providerName="System.Data.OleDb"/>-->
</connectionStrings>

Access数据库的SqlHelper

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.OleDb;
namespace CZBK.BookShop.AccessDal
{
public class SqlHelper
{
private readonly static string connectionString =ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
public static DataTable GetTable(string sql, CommandType type, params OleDbParameter[] pars)
{
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
using (OleDbDataAdapter apter = new OleDbDataAdapter(sql, connection))
{
if (pars != null)
{
apter.SelectCommand.Parameters.AddRange(pars);
}
DataTable da = new DataTable();
apter.SelectCommand.CommandType = type;
apter.Fill(da);
return da;
}
}
}
}
}

Access数据库连接字符串的更多相关文章

  1. Access 数据库连接 字符串

    <!--Microsoft.Practices.EnterpriseLibrary.Data.dll 操作引用程序集--> <connectionStrings> <ad ...

  2. Access数据库连接封装类

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...

  3. [数据库连接字符串] Access 连接字符串

    [数据库连接字符串] Access 连接字符串 //ODBC 标准安全策略 Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb ...

  4. web.config数据库连接字符串

    我们在做VB数据库经典实例这本书上的五个小例子和做学生信息管理系统时,都需要通过Vb链接数据库,在众多的链接方式中connectionstring字符串应该是较为简单的一种方式,下面我来详细介绍它的一 ...

  5. 【转】ASP.NET数据库连接字符串总结

    来源:http://blog.csdn.net/lutinghuan/article/details/5973897 ASP.NET数据库连接字符串总结 一.使用OleDbConnection对象连接 ...

  6. [转]ASP.NET数据库连接字符串总结

    这个不难,而且很重要,但总忘,找了篇比较全的,作为资料. 原文链接http://developer.51cto.com/art/201107/275406.htm 关于数据库链接字符串的相关知识,我们 ...

  7. Enterprise Library 中加密数据库连接字符串

    看了SHY520写的关于Data Access Application Block的文章,写得不错,忽略了一点就是如何去加密数据库连接字符串,这儿我简单的介绍一下.我们知道,在Enterprise L ...

  8. C#数据库连接字符串

    转自:http://blog.csdn.net/xiaokexinger/article/details/1541441 在MSDN中,.net的数据库连接字符串都有详细的说明,我这里以代码范例的方式 ...

  9. ASP.NET web.config中数据库连接字符串connectionStrings节的配置方法

    ASP.NET web.config中数据库连接字符串connectionStrings节的配置方法 第一种情况,本地开发时,使用本地数据库,如下面的代码 <connectionStrings& ...

随机推荐

  1. vue cli3使用webpack4打包优化

    去掉console.log,以及开启gzip const CompressionPlugin = require('compression-webpack-plugin');//引入gzip压缩插件 ...

  2. ASP.NET打开项目错误:将指定的计数添加到该信号量中会导致其超过最大计数。

    1.错误如图 2.解决方案 重启IIS即可,运行-> 输入IISRESET 命令 即可重启IIS,如图

  3. STL之__ type_traits

    __type_traits:双底线是说明这是SGI STL内部使用的东西,不在STL标准范围之内.iterator_traits负责萃取迭代器(iterator)的特性.而__type_traits则 ...

  4. Bootstrap 附加导航(Affix)插件

    附加导航(Affix)插件允许指定 <div> 固定在页面的某个位置.一个常见的例子是社交图标.它们将在某个位置开始,但当页面点击某个标记,该 <div> 会锁定在某个位置,不 ...

  5. sql中取出字符串中数字

    select substring(reverse('0->星光'),PATINDEX('%[0-9]%',reverse('0->星光')),1)

  6. vue better-scroll 下拉上拉,加载刷新

    _initScroll(){             this.$nextTick(() => {                 if (!this.scroll) {             ...

  7. bzoj1568 Blue Mary

    题意:P:加入一条一次函数.Q:询问x位置的最大函数值. 标程: #include<bits/stdc++.h> using namespace std; ; int q,x,n; dou ...

  8. double to string 损失精度的问题

    https://blog.csdn.net/magieclarence/article/details/6792511?utm_source=blogxgwz0 类似于这样 double 的精度是一个 ...

  9. thinkphp 批量配置

    C配置方法支持批量配置,例如: $config = array('WEB_SITE_TITLE'=>'ThinkPHP','WEB_SITE_DESCRIPTION'=>'开源PHP框架' ...

  10. 概率dp——hdu4089推公式+循环迭代

    迭代是化简公式的常用技巧 dp[i][j]表示队伍中有i人,tomato排在第j位出现情况2的概率,那么先推出公式再进行简化 dp[i][1]=p21*dp[i][i] + p41 j<=k : ...