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

来源:互联网 发布:golang mongodb 查询 编辑:程序博客网 时间:2024/06/04 19:00
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 TryEnd Sub
0 0