2015-12-30 62 views
-2

我怎樣才能把這段代碼轉換線轉換的SQL Server類VB到C#

Public Sub New()  
    /*'StoredProcedure USE*/ 
    MyBase.New(ConnectionStrings("MSSQL_DBConnectionString").ToString, "") 
    Me.SelectCommandType = SqlDataSourceCommandType.StoredProcedure 
    Me.InsertCommandType = SqlDataSourceCommandType.StoredProcedure 
    Me.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure 
    Me.UpdateCommandType = SqlDataSourceCommandType.StoredProcedure 
End Sub 

我也試着http://converter.telerik.com/但不工作的結果。

public New() :base(ConnectionStrings("MSSQL_DBConnectionString").ToString, ""){ 
this.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; 
this.InsertCommandType = SqlDataSourceCommandType.StoredProcedure; 
this.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure; 
this.UpdateCommandType = SqlDataSourceCommandType.StoredProcedure;} 

謝謝您的幫助

+3

什麼是你的錯誤?確定你在'.ToString'之後沒有遺漏一些括號?所以'.ToString()'。 –

+2

錯誤說的是什麼?另外,連接字符串可能會使用錯誤的括號'() - > []' – Ian

回答

0

您必須輸入有效的VB代碼到任何轉換器,以獲得一個有意義的結果(您的評論是不是VB評論)。 C#的等效構造如下,但類名是未知的 - 與封閉類的名稱替換「類名」:

public <class name>() : base(ConnectionStrings["MSSQL_DBConnectionString"].ToString(), "") 
{ 
    ///*'StoredProcedure USE*/ 
    this.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; 
    this.InsertCommandType = SqlDataSourceCommandType.StoredProcedure; 
    this.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure; 
    this.UpdateCommandType = SqlDataSourceCommandType.StoredProcedure; 
}