C# WPF 文件创建 [英] C# WPF Files Creation

查看:29
本文介绍了C# WPF 文件创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 C# WPF 创建 access 2000-2003 文件并在其中添加表、数据并对其执行查询?

How can I create access 2000-2003 file using C# WPF and add tables in, data in and perform queries on it?

推荐答案

您可以像在任何其他 C# .NET 应用程序中那样执行此操作;是否使用WPF并不重要.

You can do this like in any other C# .NET application; it does not matter whether or not WPF is used.

Microsoft 知识库文章 317881 解释了如何在C#.

Microsoft Knowledge Base Article 317881 explains how to create an empty database in C#.

您可以使用 OLE DB 添加数据和执行查询.MSDN 库有一些示例,例如这篇文章.

You can add data and perform queries using OLE DB. The MSDN Library has some samples, e.g. this article.

为了创建表,您可以执行 SQL 语句 CREATE TABLE.例如,

In order to create tables, you could execute the SQL statement CREATE TABLE. For example,

   string cmd = "CREATE TABLE myTable (id INTEGER, txt CHAR(20))";
   OleDbCommand cmd = new OleDbCommand(sql, oleDbConnection);
   cmd.ExecuteNonQuery();

创建一个包含id"和txt"两列的表.

creates a table with the two columns "id" and "txt".

我希望,这会有所帮助.

I hope, this helps.

这篇关于C# WPF 文件创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆