📄 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 + -