星期三, 3月 18, 2009

資料庫取資料

最近 這些程式片段應該會是我的好朋友 囧


Using cn As New SqlConnection
cn.ConnectionString = " "
cn.Open()
Using cmd As New SqlCommand("GetBikeTypeToArray", cn)
cmd.CommandType = CommandType.StoredProcedure

Dim dr As SqlDataReader = cmd.ExecuteReader
Dim i As Integer
Do While dr.Read
For i = 0 To dr.FieldCount - 1
'lstResult.Items.Add(dr.GetName(i) & ":" & dr.Item(i))
Otem = dr.Item(i)
tem.Add(Otem)
Next
Loop
End Using
End Using

沒有留言: