⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 finddataview.aspx

📁 asp.net技术内幕的书配源码
💻 ASPX
字号:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<%
DataSet dstAuthors;
SqlConnection conPubs;
SqlDataAdapter dadAuthors;
DataView dvwAuthors;
Object[] arrValues = new Object[2];
 
// Grab Authors Table
dstAuthors = new DataSet();
conPubs = new SqlConnection( @"Server=localhost;Integrated Security=SSPI;Database=Pubs" );
dadAuthors = new SqlDataAdapter( "Select * From Authors", conPubs );
dadAuthors.Fill( dstAuthors, "Authors" );

// Create DataView
dvwAuthors = dstAuthors.Tables[ "Authors" ].DefaultView;
dvwAuthors.Sort = "au_lname, au_fname";

// Find Ann Dull
arrValues[0] = "Dull";
arrValues[1] = "Ann";
int intRowIndex = System.Convert.ToInt32(dvwAuthors.Find (arrValues) );


// Display Phone Number
if ( intRowIndex != -1 ) 
{
  Response.Write( dvwAuthors[ intRowIndex ]["Phone"]);
} 
else
{
  Response.Write( "Can't find Ann Dull :)" );
}
%>
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -