从DB2提取数据 [英] Pulling data from DB2

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

问题描述

您好,我希望对DB2编程经验丰富的人可以帮助新程序员走上正确的道路.

我得到了一个项目,该项目需要我从公司DB2数据库中的表中提取数据,并且在说完之后将这些数据放入excel工作簿中.我没有DB2.我的机器上的.NET数据提供程序,似乎没有我可以得到的.由于公司(金融机构)的性质,他们宁愿应用程序不使用LINQ或类似的东西.他们希望我们编写一个查询(使用.qry文本文件)并让应用程序读取该文件,该文件位于LAN上的某个位置.

现在,我了解了(并可以从同事那里获得帮助)如何编写和读取SQL部分.我对如何使用A有点迷惑.)连接到DB2和B并从DB2中获取数据.)系统地将其放入Excel工作簿中.

我已经看到有一些针对DB2编写的类似应用程序,但是不幸的是,它们是使用Excel中的VBA作为宏编写的.他们把我带入了实习生,因为我现在正在学校学习C#,他们想开始着手在.NET中开发程序.

我有使用Microsoft Office Interop for Excel自动化Excel的经验,因此,如果我可以学习如何将提取的DB2数据转换为可以粘贴"到Excel的对象,那将很好用.

任何有过针对任何DBMS编程经验的人都可以向我指明正确的方向(通过解释或向我展示一些教程的位置),因为据我所知,在这种意义上,它们都非常相似...并且任何帮助将不胜感激!

Hello, I''m hoping that someone with experience with programming against DB2 can help a new programmer down the correct path.

I''ve been given a project that requires me to pull data from tables in the companies DB2 database, and when all said and done have that data placed into an excel workbook. I don''t have the DB2. NET Data Provider on my machine, and it doesn''t appear that I can get it. Due to the nature of the company (financial institution), they would rather the application not use LINQ or anything like that. They prefer for us to write a query (using a .qry text file) and have the application read in that file, which would be located somewhere on the LAN.

Now, I understand (and can get help from co-workers) how to write the SQL part, and read it in. I am just sort of lost on how to A.) connect to and get the data out of DB2, and B.) systematically put it into an Excel workbook.

There have been some similar applications written against the DB2 that I can look at, but unfortunately they were written as Macros using VBA in Excel. They have brought me in as an intern because I am studying C# right now at school, and they want to start moving towards having programs being developed in .NET.

I have experience using the Microsoft Office Interop for Excel to automate Excel, so if I can learn how to make the extracted DB2 data into an object that can be "pasted" into Excel some way, that would work just fine.

Anyone out there that has experience programming against any sort of DBMS could probably point me in the right direction (either by explaining, or showing me where some tutorials are) as from what I understand, they are all pretty similar in this sense...and ANY help would be greatly appreciated!

推荐答案

LINQ不会在没有数据提供者的情况下为您提供任何数据访问权限,您肯定不会那样做?

我要说的是,您需要找到该数据提供者.如果它不存在,那么您的下一个选择就是问自己是否有C ++或其他语言的数据提供程序,您可以使用该语言编写.NET代码可以调用的COM组件.如果它们有任何可以调用此数据库的dll,则可以p/调用它们,而无需COM.
LINQ won''t give you any data access without a data provider anyhow, surely you didn''t think it would ?

I would say that you need to find that data provider. If it doesn''t exist, your next bet is to ask yourself if they have a data provider in C++ or another language you can use to write a COM component that your .NET code can call. If they have any dlls that can call this DB, you can p/invoke them, you don''t need COM.


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

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