📄 sqldatasetdoublefill.aspx
字号:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat=server>
void Page_Load(Object sender , EventArgs e)
{
DataSet dstNorthwind;
SqlConnection conNorthwind;
SqlDataAdapter dadNorthwind;
// Create the DataSet
dstNorthwind = new DataSet();
// Open database connection
conNorthwind = new SqlConnection( @"Server=localhost;Integrated Security=SSPI;Database=Northwind" );
conNorthwind.Open();
// Add two tables
dadNorthwind = new SqlDataAdapter( "Select * From Categories", conNorthwind );
dadNorthwind.Fill( dstNorthwind, "Categories" );
dadNorthwind.SelectCommand = new SqlCommand( "Select * From Products", conNorthwind );
dadNorthwind.Fill( dstNorthwind, "Products" );
// Close the connection
conNorthwind.Close();
Response.Write("Categories and Products tables added to DataSet!");
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -