2009-10-08 55 views
0

我將通過OTA API從VB.net連接到Quality Center的應用程序轉換爲C#。該應用程序廣泛使用記錄集,但我無法讓他們在C#中工作。如何使用C#生成Quality Center記錄集?

具體來說,我無法將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 

回答

0

一些工作,和很多敲我的頭在牆上後,我想出了以下解決方案:

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; 

     } 

似乎做的工作。