易截截图软件、单文件、免安装、纯绿色、仅160KB

c#操作access数据库

 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace AddressList
{
public partial class FrmAccessUse : Form
{
public FrmAccessUse()
{
InitializeComponent();
}
#region 调用access标准方法
// using System.Data.OleDb;
// using System.Data;
// 连接字符串:String connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=product.mdb";
// 建立连接:OleDbConnection connection = new OleDbConnection(connectionString);
// 使用OleDbCommand类来执行Sql语句:
// OleDbCommand cmd = new OleDbCommand(sql, connection);
// connection.Open();
// cmd.ExecuteNonQuery();
#endregion
#region 连接字符串
//string strcon = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\程序书籍软件\c#程序代码\access数据库操作\addressList.mdb"; //绝对路径
string strcon = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Environment.CurrentDirectory+"\\addressList.mdb"; //相对路径
#endregion
#region 查询
private void tsbQuery_Click(object sender, EventArgs e)
{
query();
}
#endregion
#region 查询语句
private void query()
{
try
{
gridView1.Columns.Clear();
OleDbConnection connet1 = new OleDbConnection(strcon);
string sql = "select * from new1";
connet1.Open();
OleDbDataAdapter myadapter = new OleDbDataAdapter();
DataSet ds = new DataSet();
myadapter.SelectCommand = new OleDbCommand(sql, connet1);
myadapter.Fill(ds);
gridControl1.DataSource = ds.Tables[0];
connet1.Close();


相关文档:

Fingerprint Time Attendance Access System

 HTML clipboard
Revealing the revolutionary fingerprint access clocking in/out system for
businesses. No more cards, no more paperwork, no more hassle! This digital
fingerprint access terminal and data logger registers finger prints for time
management plus also works as an authorized pe ......

Access Code Fingerprint Door Lock

 HTML clipboard
Presidential edition double action fingerprint and access code security door
lock for your office, business or home. Get 100% safety at your entry point with
this maximum security style deadbolt double action lock.
This is one of the best and most secure methods in assuri ......

Access Code + Fingerprint Door Lock

Double action
fingerprint
and access code security door lock for your home,
office or small business. Get modern biometric security at your entry point with
this standard door handle style double action doorlock.
This is the most secure and convenient method in assuring only authorized peo ......

access 的多个left join 要加括号

 string sql = "select  a.orderId,a.UserName,b.CodeValue as Delivery ,a.DeliveryAddress,a.PhoneNum,c.CodeValue as Payment,d.CodeValue as OrderStatus,d.CodeValue as OrderStatusID,a.OrderTime,a.Merchant from  (( m_Order a ";
            sql += " left j ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号