📄 default.aspx
字号:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<Script language="VB" runat="server">
Public Sub Page_Load(sender As Object, e As EventArgs)
Dim connection As SqlConnection
Dim command As SqlCommand
Dim reader As SqlDataReader
Dim sqlSelect As String
Dim dsn As String
' Name dsn and sql select
dsn=ConfigurationSettings.AppSettings("DsnPubs")
sqlSelect="Select * From stores"
' Connect to the database
connection = New SqlConnection(dsn)
command = New SqlCommand(sqlSelect, connection)
' Open the connection
connection.Open()
' Create the reader
reader = command.ExecuteReader()
' Populate the datagrid
datagrid1.DataSource = reader
datagrid1.DataBind()
' Close the connection
connection.Close()
End Sub
</Script>
<asp:datagrid id="datagrid1" runat="server" />
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -