📄 studentdata.aspx.vb
字号:
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents grdStudent As System.Web.UI.WebControls.DataGrid
Protected WithEvents conConnection As System.Data.OleDb.OleDbConnection
Protected WithEvents cmdCommand As System.Data.OleDb.OleDbCommand
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents lblHeading As System.Web.UI.WebControls.Label
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.conConnection = New System.Data.OleDb.OleDbConnection()
Me.cmdCommand = New System.Data.OleDb.OleDbCommand()
'
'conConnection
'
Me.conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\Inetpub" & _
"\wwwroot\Chapter15\Course.mdb;Mode=Share Deny None;Extended Properties="""";Jet OL" & _
"EDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password=""""" & _
";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Part" & _
"ial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Passw" & _
"ord="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;J" & _
"et OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Re" & _
"pair=False;Jet OLEDB:SFP=False"
'
'cmdCommand
'
Me.cmdCommand.CommandText = "SELECT StudentInformation.* FROM StudentInformation ORDER BY StudentID"
Me.cmdCommand.Connection = Me.conConnection
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Get data and display in grid
conConnection.Open()
grdStudent.DataSource = cmdCommand.ExecuteReader()
grdStudent.DataBind()
conConnection.Close()
conConnection.Dispose()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -