📄 groupsdlist.vb
字号:
Option Strict Off
Imports System
Imports System.Collections
Imports System.Text
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Class BaseClass
Inherits System.Web.UI.Page
protected Grid1 as Datalist
Protected Message as label
Dim myConnection As OleDbConnection
Dim myCommand As OleDbDataAdapter
Dim ds As New DataSet
Dim ConnStr As String
Dim SQL As String
Sub Page_Load(Source As Object, E As EventArgs)
ConnStr = "Provider=SQLOLEDB; Data Source=(local); Initial Catalog=ASPNET;User ID=sa;"
myConnection = New OleDbConnection(ConnStr)
if NOT (isPostBack)
rebind
end if
End Sub
Sub ReBind()
'DataSetCommand
SQL = "select * from Groups"
myCommand = New OleDbDataAdapter(SQL, myConnection)
'use Fill method of DataSetCommand to populate dataset
myCommand.Fill(ds, "Groups")
'Binding a Grid
Grid1.DataSource=ds.Tables("Groups").DefaultView
Grid1.DataBind()
end sub
Sub DataList_EditCommand(sender As Object, e As DataListCommandEventArgs)
Grid1.EditItemIndex = e.Item.ItemIndex
rebind
End Sub
Sub DataList_CancelCommand(sender As Object, e As DataListCommandEventArgs)
Grid1.EditItemIndex = -1
rebind
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -