QuickBooks和Sage数据导出器
許多中小企業(yè)都使用QuickBooks作為其會(huì)計(jì)模塊。 同樣,許多公司也使用Sage進(jìn)行會(huì)計(jì)處理。 他們中的大多數(shù)人在需要從這些系統(tǒng)中導(dǎo)出數(shù)據(jù)時(shí)會(huì)遇到問題。
在線提供的許多連接器價(jià)格昂貴,無法滿足確切的要求。 隨附的是一些簡(jiǎn)短的代碼段,這些代碼段說明了如何將數(shù)據(jù)導(dǎo)出到CSV。 我還附加了github鏈接來下載代碼。
SAGE和Quickbook都帶有ODBC驅(qū)動(dòng)程序,可以對(duì)它們進(jìn)行配置和編程查詢
#智者
在ODBC數(shù)據(jù)源中創(chuàng)建一個(gè)靜默ODBC DSN。
在“選項(xiàng)”選項(xiàng)卡中配置靜默模式。
現(xiàn)在,我們將使用下面的數(shù)據(jù)源加載和導(dǎo)出數(shù)據(jù)。
我們將使用DotNet Core將我們的代碼編寫為與Windows上的DSN交流的最佳語言。
我將問題分為3個(gè)部分
現(xiàn)在我們需要編寫代碼以加載給定表的數(shù)據(jù)。 在這種情況下,我將使用DataSet。 有很多方法可以做到這一點(diǎn)。
public static DataSet GetDataSetFromAdapter(DataSet dataSet, string connectionString, string queryString){using (OdbcConnection connection =new OdbcConnection(connectionString)){OdbcDataAdapter adapter =new OdbcDataAdapter(queryString, connection);// Open the connection and fill the DataSet.try{connection.Open();adapter.Fill(dataSet);}catch (Exception ex){Console.WriteLine(ex.Message);}// The connection is automatically closed when the// code exits the using block.}return dataSet;}最后是將所有數(shù)據(jù)導(dǎo)出到CSV的功能
<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span>private static string ConvertToCSV(DataSet objDataSet){StringBuilder content = new StringBuilder();if (objDataSet.Tables.Count >= 1){DataTable table = objDataSet.Tables[0];if (table.Rows.Count > 0){DataRow dr1 = (DataRow) table.Rows[0];int intColumnCount = dr1.Table.Columns.Count;int index=1;//add column namesforeach (DataColumn item in dr1.Table.Columns){content.Append(String.Format("\"{0}\"", item.ColumnName));if (index < intColumnCount)content.Append(",");elsecontent.Append("\r\n");index++;}//add column dataforeach (DataRow currentRow in table.Rows){string strRow = string.Empty;for (int y = 0; y <= intColumnCount - 1; y++){strRow += "\"" + currentRow[y].ToString() + "\"";if (y = 0)strRow += ",";}content.Append(strRow + "\r\n");}}}return content.ToString();}https://github.com/ashwinrayaprolu1984/SageDataExporter.git
#QuickBooks
對(duì)于QuickBooks,我們采用相同的方法。
git hub下面的鏈接具有執(zhí)行此操作的代碼
https://github.com/ashwinrayaprolu1984/QuickBooksDesktopConnector.git
翻譯自: https://www.javacodegeeks.com/2018/11/quickbooks-sage-data-exporter.html
總結(jié)
以上是生活随笔為你收集整理的QuickBooks和Sage数据导出器的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 腾讯云阿里云华为云的区别(腾讯云阿里云d
- 下一篇: 路由器被ddos会断网吗(ddos总是断