日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

QuickBooks和Sage数据导出器

發(fā)布時(shí)間:2023/12/3 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 QuickBooks和Sage数据导出器 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

許多中小企業(yè)都使用QuickBooks作為其會計(jì)模塊。 同樣,許多公司也使用Sage進(jìn)行會計(jì)處理。 他們中的大多數(shù)人在需要從這些系統(tǒng)中導(dǎo)出數(shù)據(jù)時(shí)會遇到問題。

在線提供的許多連接器價(jià)格昂貴,無法滿足確切的要求。 隨附的是一些簡短的代碼段,這些代碼段說明了如何將數(shù)據(jù)導(dǎo)出到CSV。 我還附加了github鏈接來下載代碼。

SAGE和Quickbook都帶有ODBC驅(qū)動程序,可以對它們進(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è)部分

  • 從數(shù)據(jù)庫加載表名
  • 為每個(gè)表加載數(shù)據(jù)集
  • 將每個(gè)表從DataSet導(dǎo)出到CSV
  • private static List loadTableNames(string connectionString){var tableNames = new List();using (OdbcConnection connection =new OdbcConnection(connectionString)){try{connection.Open();using(DataTable tableschema = connection.GetSchema("Tables")){// first column nameforeach(DataRow row in tableschema.Rows){tableNames.Add(row["TABLE_NAME"].ToString());//Console.WriteLine(row["TABLE_NAME"].ToString());}}}catch (Exception ex){Console.WriteLine(ex.Message);}}return tableNames;}

    現(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

    對于QuickBooks,我們采用相同的方法。

  • 從文件中加載表名(Quickbooks不在其ODBC數(shù)據(jù)源中導(dǎo)出架構(gòu))
  • 為每個(gè)表加載數(shù)據(jù)集
  • 將每個(gè)表從DataSet導(dǎo)出到CSV
  • git hub下面的鏈接具有執(zhí)行此操作的代碼

    https://github.com/ashwinrayaprolu1984/QuickBooksDesktopConnector.git

    翻譯自: https://www.javacodegeeks.com/2018/11/quickbooks-sage-data-exporter.html

    總結(jié)

    以上是生活随笔為你收集整理的QuickBooks和Sage数据导出器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。