如何使用 C# 生成 Quality Center 记录集?

发布于 2024-08-06 13:46:47 字数 437 浏览 3 评论 0原文

我正在将通过 OTA API 连接到 Quality Center 的应用程序从 VB.net 转换为 C#。该应用程序广泛使用记录集,但我无法让它们在 C# 中工作。

具体来说,我无法将 Command 和 Recordset 转换为 C# 的正确格式。我尝试过的一切都失败了。

以下是我需要转换的代码的 VB.net 示例。

Private Function GetRecSet(ByVal Qry As String, TD as TDConnection) As Recordset

        Dim Com As Command = TD.Command
        Com.CommandText = Qry
        GetRecSet = Com.Execute
        GetRecSet.First()

End Function

I am converting an application that connects to Quality Center via the OTA API from VB.net to C#. The application makes extensive use of recordsets, but I have not been able to get them to work in C#.

Specifically, I have trouble casting Command and Recordset to the correct format for C#. Everything I have tried has failed.

Following, is an VB.net example of the code that I need to convert.

Private Function GetRecSet(ByVal Qry As String, TD as TDConnection) As Recordset

        Dim Com As Command = TD.Command
        Com.CommandText = Qry
        GetRecSet = Com.Execute
        GetRecSet.First()

End Function

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谈场末日恋爱 2024-08-13 13:46:47

经过一番工作,并多次用头撞墙后,我想出了以下解决方案:

static TDAPIOLELib.Recordset GetRecSet(String Qry, TDAPIOLELib.TDConnection TD)
        {

            TDAPIOLELib.Command Com;
            Com = TD.Command as TDAPIOLELib.Command;
            Com.CommandText = Qry;

            TDAPIOLELib.Recordset RecSet = Com.Execute() as TDAPIOLELib.Recordset;
            return RecSet;

        }

它似乎可以完成工作。

After a bit of work, and a lot of banging my head against a wall, I came up with the following solution:

static TDAPIOLELib.Recordset GetRecSet(String Qry, TDAPIOLELib.TDConnection TD)
        {

            TDAPIOLELib.Command Com;
            Com = TD.Command as TDAPIOLELib.Command;
            Com.CommandText = Qry;

            TDAPIOLELib.Recordset RecSet = Com.Execute() as TDAPIOLELib.Recordset;
            return RecSet;

        }

It seems to do the job.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文