您的位置:首页 > 数据库

VB查询数据库用于Ext.NET的Store

2016-07-20 17:26 337 查看
Public Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
con.Open()
Dim myCommand As New SqlCommand
myCommand.CommandType = Data.CommandType.StoredProcedure
myCommand.CommandText = "SeekAgentsByServer_sp"
myCommand.Connection = con
Dim reader As SqlDataReader = myCommand.ExecuteReader
Dim result As New List(Of Object)

result.Add(New With {
.AgentName = "全部",
.AgentID = ""
})

While (reader.Read())
result.Add(New With {
.AgentName = reader("AgentName").ToString,
.AgentID = reader("AgentID").ToString
})
End While

Me.AgentStore.Data = result
Me.AgentStore.DataBind()
con.Close()
Catch ex As Exception
Ext.Net.X.MessageBox.Alert("提示", ex.Message).Show()
Return
End Try
End Sub
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  vb