|
C#語法改寫VB語法,SERVER METHOD範例? |
|
|
原文C# ServerMethod public object CallTest(object[] objParam) { string str = objParam[0].ToString(); string sql= "select avg(UnitPrice) as AvgPrice from [order details] Where ProductID="; sql = sql + str; DataSet Tmp = ExecuteSql("view", sql, true); string retval=Tmp.Tables[0].Rows[0][ "AvgPrice"].ToString(); Thread.SlEEP(5000); object ret; ret = new object[] { 0, retval}; return ret; }
改寫為VB: Public Function CallTest(ByVal objParam() As Object) As Object() Dim str As String str = objParam(0).ToString() Dim sql As String sql = "select avg(UnitPrice) as AvgPrice from [order details] Where ProductID=" sql = sql + str Dim tmp As DataSet tmp = ExecuteSql("view", sql, True) Dim retval As String retval = tmp.Tables(0).Rows(0)("AvgPrice").ToString() System.Threading.Thread.SlEEP(5000) Dim ret As Object ret = New Object() {0, retval} Return ret End Function
|
|
|