如何从Access数据库中读取 [英] How to read from Access database

查看:102
本文介绍了如何从Access数据库中读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,



我会在我提出问题之前向你介绍我的任务/问题。



我有一个MS-Access数据库和包含唯一ID的some.txt文件。这些ID对应于我的数据库中的ID。该文本文件是从第三方SW生成的。我需要读取这个文件(获取那些ID),连接到Access数据库,从数据库中读出所有相关数据,列表进入某些App,这样用户可以从这些选项中选择然后将他的选择导出到Excel表中。



Access数据库包含有关电子组件的信息。让我们说它是一个连接器,连接器可以有不同的颜色,不同数量的终端,不同的终端等。



所以txt文件包含连接器的ID,是也存储在数据库中的此ID下。用户打开一些应用程序(数据库和文件之间的接口),打开相应的txt文件。打开文件将连接到数据库,读取具有给定ID的连接器有14个引脚,连接器有三种可能的颜色,端子A,B和F可以与它一起使用。



使用应用程序,用户选择颜色2和终端F.这将打印到一些excel woorkbook。



我在想使用QT作为应用程序。



问题:

1)如何连接数据库并读出信息?我已经阅读过有关ODBC,OleDB,ADO和其他内容的内容,但说实话,我不太了解,使用什么,或者为什么要使用它......目前,MSDN中的引用对我来说还很难。



2)是否可以使用QT连接数据库?一切都是在.NET中知道的,我不确定,如果这两种技术是兼容的,或者我可以将它们混合起来。





我对C语言有着非常扎实的了解,我是C ++的初学者,我理解数据库的基础知识,什么是数据库,大致是结构,但没有实际经验。





你能给我一些建议吗,我应该选择哪种方法?

非常感谢你的帮助,祝你有个美好的一天! br />
Vojtech

Hi guys,

I'll try to introduce you my task/issue, before my question.

I have an MS-Access database and "some.txt" file containing unique ID's. Those ID's correspond to the ones in my database. This text file is generated from a third party SW. I need to read this file (to get those ID's), connect to the Access database, read out all relevant data from the database, list is into some App, so the user can choose from those options and then export his choice into Excel table.

The Access database holds informations about electrical components. Let's say its a connector, the connector can have different colors, different number of terminals, different terminals etc.

So the txt file contains the ID of the connector and is also stored under this ID in the database. The user opens some app (interface between the database and the file), opens the corresponding txt file. Opening the file will connect to the database, read that Connector with the given ID has 14 Pins, there are three possible colors for the connector and terminals A, B & F can be used with it.

Using the App the users choose color 2, and Terminal F. This will be then printed into some excel woorkbook.

I was thinking to use QT for the App.

Questions:
1) How to connect to the database and read out the informations? I've read about ODBC, OleDB, ADO and other stuff, but honestly I don't understand much, what to use, or why to use it... also the reference in MSDN is quite hard for me at the moment.

2) Is it possible to connect to the database using QT? Everything is know in .NET and I'm not sure, if those two technologies are compatibile or I can mix them up.


I got a pretty solid knowledge of C languace, I'm a beginner in C++ and I understand the very basics of Databases, what is a database and roughly the structure, but no practical experiences.


Can you please give me some advices, which approach I should choose?
Thank you very much for your help and have a nice day!
Vojtech

推荐答案

对不起,这不是一个快速回答的问题。如你所说,你是初学者。 C知识很棒,但它只是一种语言,你现在需要使用一大堆你不知道的工具。我真的不知道除了这个社区有什么帮助。根据你所写的内容,你知道自己的方向,但缺乏知识。我们不能给你知识。你需要尝试,学习,奋斗,获得一些经验。如果你陷入某种具体情况,你可以问一些可以解决的问题。

我可以给你一个建议:既然你谈论.NET,如果你想快速得到结果,你最好不要挣扎C ++(在你的情况下是托管C ++),你最好学习C#。您不必忘记C和C ++,因为语法来自同一个来源。可能值得一本书,但你也可以从这里开始: http://www.tutorialspoint.com/csharp/ [ ^ ]

但是有一个很大的飞跃在标准C和.NET下开发你描述的应用程序。



当然,你可以使用QT来做你想要的所有事情。但是你可以在C#中做同样的事情,与QT开发这样的任务进行编码分解...
Sorry, but this is not a "quick answers" kind of question. As you stated, you are beginner. C knowledge is great, but it is just a language, and you need to use now a large set of tools you don't know. I really don't know what help you except from this community. Based on what you wrote, you know your direction, but you lack of knowledge. We can't give you knowledge. You will need to try, learn, struggle, get some experience. If you are stucked in a concrete situation you can ask something that can be aswered.
I can give you one advice: since you speak about .NET, if you want results quickly, you better not struggle with C++ (managed C++ in your case), you better learn C#. You don't have to forget C and C++, as the syntax is from same origin. Might be worth getting a book, but you can also start here: http://www.tutorialspoint.com/csharp/[^]
But there is a big leap between standard C and developing under .NET an application you described.

Of course, you could use QT to do all those you want. But you can do the same in C# with a fracttion of coding compared to QT development of such a task...


这篇关于如何从Access数据库中读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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