保存客户端从服务器读取的数据。 [英] saving the data read by the client from a server.

查看:168
本文介绍了保存客户端从服务器读取的数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在visual studio中用c ++编写了客户端服务器程序,我有一个定义的功能,用于连接服务器,读取数据集,数据模型等。我运行它连接到服务器的程序,它显示输出一个命令提示符,因为它是一个exe。如何使用odbc或任何其他方法将显示在cmd提示符下的这些数据发送到excel文件?

我不是该领域的专家。通过代码,链接或步骤的任何帮助对我都有很大的帮助。

I have client-server program written in c++ in visual studio, I have a function defined in that to connect to a server, read data sets, data model etc. I run the program it connects to server and it displays output on a command prompt as it is an exe . How do I send these data that are displayed on cmd prompt to a excel file using odbc or by any other means??
I am not a expert in this field. Any help thru code, link or steps would be of great help to me.

推荐答案

这里有一篇旧文章:使用ODBC创建Excel表格 [ ^ ]。它使用MFC CDatabase 类使用ODBC编写Excel文件。



我更喜欢使用ADO(OLE DB)而不是ODBC。它允许通过值而不是文本传递数据,这对浮点值特别有用,以避免舍入错误。这不需要MFC,但是比仅使用ODBC命令更复杂。文章:如何读写Excel C ++中的文件通过ADO [ ^ ]。



作为替代方案,您可以创建CSV,TAB分隔文本,或者HTML文件。所有这些格式都可以通过Excel加载。
There is an old article here: Creating Excel Sheets using ODBC[^]. It uses the MFC CDatabase class to write Excel files using ODBC.

I prefer using ADO (OLE DB) instead of ODBC. It allows passing data by values rather than by text which is especially useful with floating point values to avoid rounding errors. This does not require MFC but is more complex than using SQL commands only as with ODBC. Article: How to Read and Write Excel Files in C++ via ADO[^].

As an alternative you may create a CSV, TAB separated text, or HTML file. All these formats can be loaded by Excel.


这篇关于保存客户端从服务器读取的数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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