原創|產品更新|編輯:何家巧|2022-12-06 11:58:39.093|閱讀 233 次
概述:今天我們?繼?續講解 FastReport .NET的更?新功能:添加了連接到 MsSQL 存儲過程的功能。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
今天我們繼續講解 FastReport .NET的更新功能,在本次更新中,我們添加了連接到 MsSQL 存儲過程的功能。這些存儲過程是一組同時執行的指令。因此,存儲過程允許您簡化復雜的操作并將它們放入單個對象中。
以前,您只能通過數據庫查詢連接到它們。現在使用標準方案連接數據庫表就足夠了。
程序圖標會有所不同。此外,如果過程有輸入參數,在選擇過程時則會出現一個帶有參數的窗口。在此窗口中,您需要根據需求設置參數值。如果您使用默認值,則將表達式和值字段留空。
如果過程返回輸出參數,那么它們將在創建連接后出現在“Report Parameters”中。只有當信息上傳到數據源時,這些參數才會更新。
從代碼調用過程:
// 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 進行比較,您可以在表的列表中找到過程。
現在,FastReport .NET 用戶可以更快、更輕松地在多個報表中使用預先準備好的數據選擇腳本。
關于從報表控件FastReport .NET v2023.1中添加了連接到 MsSQL 存儲過程功能的介紹就到這里了,接下來將繼續介紹其他更新模塊,請持續關注哦~
FastReport技術QQ群:536197826 歡迎進群一起討論
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn