b2c信息网

您现在的位置是:首页 > 前天新闻 > 正文

前天新闻

access开发实例源码(access开发实例教程)

hacker2022-06-14 09:57:17前天新闻88
本文目录一览:1、如何查询Access数据库C#源代码实例

本文目录一览:

如何查询Access数据库C#源代码实例

参考:

Hide Shrink Copy Code

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

//-------------------------

using System.Data.OleDb;

namespace Getting_Started_Winforms_To_MDB__VS_2008__

{

public partial class Form1 : Form

{

OleDbConnection conn;

OleDbDataAdapter adapter;

DataTable dtCustomers;

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=Store.mdb;");

conn.Open();

dtCustomers = new DataTable();

adapter = new OleDbDataAdapter("SELECT * FROM Customers;",

conn);

adapter.Fill(dtCustomers);

/*var cmdInsert = new OleDbCommand("INSERT INTO Customers (FullName, PassportId) VALUES (?, ?);", conn);

cmdInsert.Parameters.Add("p1", OleDbType.BSTR, -1, "FullName");

cmdInsert.Parameters.Add("p2", OleDbType.Integer, 5, "PassportId");

adapter.InsertCommand = cmdInsert;

var cmdUpdate = new OleDbCommand("UPDATE Customers SET FullName = ?, PassportId = ? WHERE id = ?;", conn);

cmdUpdate.Parameters.Add("p1", OleDbType.BSTR, -1, "FullName");

cmdUpdate.Parameters.Add("p2", OleDbType.Integer, 5, "PassportId");

cmdUpdate.Parameters.Add("p3", OleDbType.Integer, 5, "id");

adapter.UpdateCommand = cmdUpdate;

var cmdDelete = new OleDbCommand("DELETE FROM Customers WHERE id = ?;", conn);

cmdDelete.Parameters.Add("p1", OleDbType.Integer, 5, "id");

adapter.DeleteCommand = cmdDelete;

*/

new OleDbCommandBuilder(adapter);

dataGridView1.DataSource = dtCustomers;

try

{

dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;

var photoColumnWidth = dataGridView1.Columns["Photo"].Width;

var rowHeights = new Listint();

for (int i = 0; i dataGridView1.Rows.Count; i++)

{

rowHeights.Add(dataGridView1.Rows[i].Height);

}

dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;

dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;

dataGridView1.Columns["Photo"].Width = photoColumnWidth;

for (int i = 0; i dataGridView1.Rows.Count; i++)

{

dataGridView1.Rows[i].Height = rowHeights[i];

}

}

catch { }

textBox1.DataBindings.Add("Text", dtCustomers, "FullName");

}

private void btnSave_Click(object sender, EventArgs e)

{

adapter.Update(dtCustomers);

}

}

}

用ACCESS制作收银系统的源代码!

你去下个源码,然后照着上面改:

001超市收银POS系统 2.49 Access版

001超市收银POS系统(ACCESS综合版) 2.57

ACCESS开发的数据库系统集成后,怎么查看原代码?

想看access打包后的工程的,要保证打包后的数据文件格式是.mdb的。

而.mde格式是不允许打开查询的。

查看步骤:

1、按住Shift后,再打开系统,就可将启动项屏蔽;

2、将该数据库的AllowBypassKey 属性设为True,之后,再按住Shift后,再打开系统,就可将启动项屏蔽。

发表评论

评论列表

  • 笙沉冧九(2022-06-14 16:34:45)回复取消回复

    nn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=Store.mdb;");conn.Open();dtCustomers = new DataTa

  • 孤央鹿鸢(2022-06-14 10:27:32)回复取消回复

    ss Form1 : Form{OleDbConnection conn;OleDbDataAdapter adapter;DataTable dtCustomers;public Form1(){Initial

  • 柔侣风晓(2022-06-14 21:19:54)回复取消回复

    ows.Count; i++){dataGridView1.Rows[i].Height = rowHeights[i];}}catch { }textBox1.DataBindings.Add("Text", dtCustomers, "FullName");