易截截图软件、单文件、免安装、纯绿色、仅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();


相关文档:

VB,C#使用VC的.lib和.h文件

——————————————————————————————————
在c#中如何使用以前c++的.lib库和.h头文件
zhujiang_1977(朱江 ......

Access Web System from external

Take Equity Collection System as an example, Some other office collegues want to access it from home without VPN, The way to check is:
1.  Check if it's limited in network, this needs to confirm with network people
2.  If the step 1 passed, get the external IP address of the system, map ......

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

得到access表字段名VBS脚本

 
set adoCN   =createobject("ADODB.CONNECTION")
set strCnn  =createobject("ADODB.Recordset")    
set rstSchema   =createobject("ADODB.Recordset")
  Dim   I   
dim n
        str1 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号