?? fquerybook.aspx
字號:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="fQueryBook.aspx.vb" Inherits="圖書管理信息系統.fQueryBook" debug=true%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>fQueryBook</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script language="vb" runat="server">
Sub btnSearch_Click(sender as Object,e as EventArgs)
lblMessage.text="圖書信息一覽"
DGBook.Visible=True
Dim sLogic1,sLogic2 as String
Dim sType1,sType2,sType3 as string
Dim sKey1,sKey2,sKey3 as string
sLogic1=ddlLogic1.selectedvalue.trim '邏輯運算符1
sLogic2=ddlLogic2.selectedvalue.trim '邏輯運算符2
sType1=ddlType1.selectedvalue.trim '檢索項1
sType2=ddlType2.selectedvalue.trim '檢索項2
sType3=ddlType3.selectedvalue.trim '檢索項3
sKey1=txtKey1.text.trim '檢索詞1
sKey2=txtKey2.text.trim '檢索詞2
sKey3=txtKey3.text.trim '檢索詞3
Dim sCond,sCond1,sCond2,sCond3 as string '三個條件子句
sCond=""
sCond1=""
sCond2=""
sCond3=""
IF sKey1.equals("")=False Then
sCond1=sType1 & " LIKE '" & sKey1 & "'"
IF sKey2.equals("")=False Then
sCond2=" " & sLogic1 & " " & sType2 & " LIKE '" & sKey2 & "'"
IF sKey3.equals("")=False Then
sCond3=" " & sLogic2 & " " & sType3 & " LIKE '" & sKey3 & "'"
End IF
End IF
End IF
sCond=sCond1 & sCond2 & sCond3 '復合檢索子句
IF sCond.Equals("")=False Then
sCond="WHERE " & sCond
End IF
Dim DABook AS New SqlDataAdapter
Dim DsBook AS New DataSet
Dim SqlComm AS New SqlCommand
Dim SqlConn AS New SqlConnection
SqlConn.ConnectionString="workstation id=DEVELOPER;packet size=4096;user id=sa;data source=developer;persist security info=False;initial catalog=圖書管理信息系統"
SqlComm.Connection=SqlConn
SqlComm.CommandText="SELECT B.cBookID AS 圖書編號, BT.cBookName AS 書名, BT.cAuthor AS 作者, BT.cPubs AS 出版社, BT.mBookRate AS 單價, BT.siPages AS 頁碼, BT.dPublishDate AS 出版日期 " & _
"FROM Book B INNER JOIN BookType BT ON B.cBookTypeID = BT.cBookTypeID " & sCond
SqlConn.Open()
DABook.SelectCommand=SqlComm
DsBook.Clear()
DABook.Fill(DsBook)
DGBook.DataSource=DsBook
DGBook.DataMember=DataBinder.Eval(DsBook, "Tables[Book].DefaultView")
DGBook.DataBind()
End Sub
</script>
</HEAD>
<body background="image\back.gif" MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="宋體"></FONT>
<asp:image id="Image1" style="Z-INDEX: 101; LEFT: 144px; POSITION: absolute; TOP: 8px" runat="server"
ImageUrl="image\logo.gif" Height="48px" Width="208px"></asp:image><asp:label id="lblMessage" style="Z-INDEX: 114; LEFT: 144px; POSITION: absolute; TOP: 240px"
runat="server" Width="648px" Font-Names="宋體" Font-Bold="True" Height="16px"></asp:label><asp:datagrid id="DGBook" style="Z-INDEX: 113; LEFT: 144px; POSITION: absolute; TOP: 264px" runat="server"
Height="300px" Width="656px" BorderColor="#FFC080" BorderStyle="Double" BackColor="#E0E0E0" BorderWidth="4px" Visible="False">
<AlternatingItemStyle BackColor="#CCCC99"></AlternatingItemStyle>
<ItemStyle BackColor="#FFCC99"></ItemStyle>
<HeaderStyle Font-Size="Medium" Font-Names="隸書" Font-Bold="True" HorizontalAlign="Left" ForeColor="#333333"
VerticalAlign="Middle" BackColor="#CCCCCC"></HeaderStyle>
<PagerStyle Visible="False"></PagerStyle>
</asp:datagrid><asp:hyperlink id="HyperLink1" style="Z-INDEX: 112; LEFT: 48px; POSITION: absolute; TOP: 88px"
runat="server" NavigateUrl="fMain.aspx" Font-Size="Medium" Font-Names="隸書" Font-Bold="True">首頁</asp:hyperlink><asp:hyperlink id="HyperLink2" style="Z-INDEX: 111; LEFT: 16px; POSITION: absolute; TOP: 120px"
runat="server" NavigateUrl="fQueryReader.aspx" Font-Size="Medium" Font-Names="隸書" Font-Bold="True">讀者信息查詢</asp:hyperlink><asp:image id="Image2" style="Z-INDEX: 102; LEFT: 360px; POSITION: absolute; TOP: 8px" runat="server"
ImageUrl="image\school.jpg" Width="440px"></asp:image>
<HR style="Z-INDEX: 103; LEFT: 8px; POSITION: absolute; TOP: 72px" width="100%" SIZE="1">
<asp:table id="Table1" style="Z-INDEX: 104; LEFT: 144px; POSITION: absolute; TOP: 80px" runat="server"
Height="100px" Width="656px" HorizontalAlign="Left" BorderColor="#FFC080" BorderStyle="Double"
BackColor="#E0E0E0">
<asp:TableRow Width="100%" ForeColor="Olive" Font-Size="Medium" Font-Names="隸書" Font-Bold="True">
<asp:TableCell Text="邏輯"></asp:TableCell>
<asp:TableCell Text="檢索項"></asp:TableCell>
<asp:TableCell Text="檢索詞"></asp:TableCell>
<asp:TableCell RowSpan="4">
<asp:Button runat="server" ForeColor="Olive" ID="btnSearch" Height="24px" Font-Size="Medium"
Font-Names="隸書" Font-Bold="True" Text="檢 索" OnClick="btnSearch_Click"></asp:Button>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="+ / -"></asp:TableCell>
<asp:TableCell>
<asp:DropDownList runat="server" Width="128px" ID="ddlType1">
<asp:ListItem Value="cBookName">書名</asp:ListItem>
<asp:ListItem Value="cAuthor">作者</asp:ListItem>
<asp:ListItem Value="cBookID">書號</asp:ListItem>
</asp:DropDownList>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox runat="server" ID="txtKey1"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:DropDownList runat="server" Width="128px" ID="ddlLogic1">
<asp:ListItem Value="AND">并且</asp:ListItem>
<asp:ListItem Value="OR">或者</asp:ListItem>
</asp:DropDownList>
</asp:TableCell>
<asp:TableCell>
<asp:DropDownList runat="server" Width="128px" ID="ddlType2">
<asp:ListItem Value="cBookName">書名</asp:ListItem>
<asp:ListItem Value="cAuthor">作者</asp:ListItem>
<asp:ListItem Value="cBookID">書號</asp:ListItem>
</asp:DropDownList>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox runat="server" ID="txtKey2"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:DropDownList runat="server" Width="128px" ID="ddlLogic2">
<asp:ListItem Value="AND">并且</asp:ListItem>
<asp:ListItem Value="OR">或者</asp:ListItem>
</asp:DropDownList>
</asp:TableCell>
<asp:TableCell>
<asp:DropDownList runat="server" Width="128px" ID="ddlType3">
<asp:ListItem Value="cBookName">書名</asp:ListItem>
<asp:ListItem Value="cAuthor">作者</asp:ListItem>
<asp:ListItem Value="cBookID">書號</asp:ListItem>
</asp:DropDownList>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox runat="server" ID="txtKey3"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
</asp:table></form>
</body>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -