原創(chuàng)|產(chǎn)品更新|編輯:何家巧|2022-12-06 11:58:39.093|閱讀 233 次
概述:今天我們?繼?續(xù)講解 FastReport .NET的更?新功能:添加了連接到 MsSQL 存儲過程的功能。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
今天我們繼續(xù)講解 FastReport .NET的更新功能,在本次更新中,我們添加了連接到 MsSQL 存儲過程的功能。這些存儲過程是一組同時執(zhí)行的指令。因此,存儲過程允許您簡化復(fù)雜的操作并將它們放入單個對象中。
以前,您只能通過數(shù)據(jù)庫查詢連接到它們。現(xiàn)在使用標準方案連接數(shù)據(jù)庫表就足夠了。
程序圖標會有所不同。此外,如果過程有輸入?yún)?shù),在選擇過程時則會出現(xiàn)一個帶有參數(shù)的窗口。在此窗口中,您需要根據(jù)需求設(shè)置參數(shù)值。如果您使用默認值,則將表達式和值字段留空。
如果過程返回輸出參數(shù),那么它們將在創(chuàng)建連接后出現(xiàn)在“Report Parameters”中。只有當信息上傳到數(shù)據(jù)源時,這些參數(shù)才會更新。
從代碼調(diào)用過程:
// Create the MsSqlDataConnection object var connection = new MsSqlDataConnection(); // Set the connection string connection.ConnectionString = @"Data Source=DESKTOP-43LGTAI;AttachDbFilename=; Initial Catalog=EmployeeCaseStudy;Integrated Security=True;Persist Security Info=False;User ID=;Password="; // Initialize all tables connection.CreateAllTables(); // Set the connection name connection.Name = "NewConnection"; // Create a Report Object var report = new Report(); // Add the connection to a report report.Dictionary.Connections.Add(connection); // Enable connection display connection.Enabled = true; // Select a table and connect it to the report foreach (TableDataSource table in connection.Tables) { if (table.Name == "sp_GetUser") { foreach (CommandParameter parameter in table.Parameters) if (parameter.Name == "@id") parameter.Value = 1; table.Enabled = true; } }
通過將它們與 ProcedureDataSource 進行比較,您可以在表的列表中找到過程。
現(xiàn)在,FastReport .NET 用戶可以更快、更輕松地在多個報表中使用預(yù)先準備好的數(shù)據(jù)選擇腳本。
關(guān)于從報表控件FastReport .NET v2023.1中添加了連接到 MsSQL 存儲過程功能的介紹就到這里了,接下來將繼續(xù)介紹其他更新模塊,請持續(xù)關(guān)注哦~
FastReport技術(shù)QQ群:536197826 歡迎進群一起討論
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn