加了單引號就是一個常量字符串了,對于每一行都是一樣的
十余年建站經(jīng)驗, 成都做網(wǎng)站、網(wǎng)站設(shè)計客戶的見證與正確選擇。創(chuàng)新互聯(lián)公司提供完善的營銷型網(wǎng)頁建站明細(xì)報價表。后期開發(fā)更加便捷高效,我們致力于追求更美、更快、更規(guī)范。
像這種放在最前面的字段,order by 1 就可以了
如果你是從vb6剛過渡上vb。net,建議還是用冒泡排序法,容易理解。
如果你正努力學(xué)習(xí)vb。net的方法,推薦一個例子如下:
Imports System
Imports System.Collections
Public Class SamplesArray
Public Class myReverserClass
Implements IComparer
' Calls CaseInsensitiveComparer.Compare with the parameters reversed.
Function Compare(x As Object, y As Object) As Integer _
Implements IComparer.Compare
Return New CaseInsensitiveComparer().Compare(y, x)
End Function 'IComparer.Compare
End Class 'myReverserClass
Public Shared Sub Main()
' Creates and initializes a new Array and a new custom comparer.
Dim myArr As [String]() = {"The", "QUICK", "BROWN", "FOX", "jumps", "over", "the", "lazy", "dog"}
Dim myComparer = New myReverserClass()
' Displays the values of the Array.
Console.WriteLine("The Array initially contains the following values:")
PrintIndexAndValues(myArr)
' Sorts a section of the Array using the default comparer.
Array.Sort(myArr, 1, 3)
Console.WriteLine("After sorting a section of the Array using the default comparer:")
PrintIndexAndValues(myArr)
' Sorts a section of the Array using the reverse case-insensitive comparer.
Array.Sort(myArr, 1, 3, myComparer)
Console.WriteLine("After sorting a section of the Array using the reverse case-insensitive comparer:")
PrintIndexAndValues(myArr)
' Sorts the entire Array using the default comparer.
Array.Sort(myArr)
Console.WriteLine("After sorting the entire Array using the default comparer:")
PrintIndexAndValues(myArr)
' Sorts the entire Array using the reverse case-insensitive comparer.
Array.Sort(myArr, myComparer)
Console.WriteLine("After sorting the entire Array using the reverse case-insensitive comparer:")
PrintIndexAndValues(myArr)
End Sub 'Main
Public Shared Sub PrintIndexAndValues(myArr() As [String])
Dim i As Integer
For i = 0 To myArr.Length - 1
Console.WriteLine(" [{0}] : {1}", i, myArr(i))
Next i
Console.WriteLine()
End Sub 'PrintIndexAndValues
End Class 'SamplesArray
'This code produces the following output.
'
'The Array initially contains the following values:
' [0] : The
' [1] : QUICK
' [2] : BROWN
' [3] : FOX
' [4] : jumps
' [5] : over
' [6] : the
' [7] : lazy
' [8] : dog
'
'After sorting a section of the Array using the default comparer:
' [0] : The
' [1] : BROWN
' [2] : FOX
' [3] : QUICK
' [4] : jumps
' [5] : over
' [6] : the
' [7] : lazy
' [8] : dog
'
'After sorting a section of the Array using the reverse case-insensitive comparer:
' [0] : The
' [1] : QUICK
' [2] : FOX
' [3] : BROWN
' [4] : jumps
' [5] : over
' [6] : the
' [7] : lazy
' [8] : dog
'
'After sorting the entire Array using the default comparer:
' [0] : BROWN
' [1] : dog
' [2] : FOX
' [3] : jumps
' [4] : lazy
' [5] : over
' [6] : QUICK
' [7] : the
' [8] : The
'
'After sorting the entire Array using the reverse case-insensitive comparer:
' [0] : the
' [1] : The
' [2] : QUICK
' [3] : over
' [4] : lazy
' [5] : jumps
' [6] : FOX
' [7] : dog
' [8] : BROWN
是這么定義的:
數(shù)組中的第一個元素的下標(biāo)稱為下界,最后一個元素的下標(biāo)稱為上界,其余的元素連續(xù)地分布在上下界之間,且數(shù)組在內(nèi)存中也是用連續(xù)的區(qū)域來存儲的,所以數(shù)組每維的長度不能超過Long數(shù)據(jù)類型的最大值,即264—1=263。
把VB.NET數(shù)組當(dāng)作一個對象來處理,就意味著數(shù)組類型是單個引用類型,數(shù)組變量包括指向構(gòu)成數(shù)組元素、數(shù)組維和數(shù)組長度等數(shù)據(jù)的指針,數(shù)組之間互相賦值但僅僅是在相互復(fù)制指針,數(shù)組繼承了System名字空間的Array類。
VB.NET中的數(shù)組有兩種類型:定長數(shù)組和動態(tài)數(shù)組。
擴展資料:
1、數(shù)組的使用
在’VB 6.0中,能夠用For Each來循環(huán)遍歷一個數(shù)組。
比如:
Dim?x?As?Integer
F0r?Each?x?In?arrayl
Console.WriteLine(x)
Next?
2、在VB.NET中能夠使用For循環(huán)和數(shù)組長度來遍歷一個數(shù)組。
比如:
Dim?i?As工nteger? ?
F0r?i=0?T0??(arrayl.Length-1)
(此處空一行)
Console.WriteLine(arrayl(1)J
Next?i