📄 default.aspx
字号:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<Script Language="C#" runat="server">
public void Page_Load(Object sender, EventArgs e) {
SqlConnection connection;
SqlCommand command;
SqlDataReader reader;
string sqlSelect;
string dsn;
// 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();
}
</Script>
<asp:datagrid id="datagrid1" runat="server" />
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -