Imports System.DBNull Imports System.Data Imports System.Data.SqlClient Imports System.Data.OleDb Imports System.DateTime Imports DataAccess
Public Class Borrow Inherits System.Web.UI.Page Public DB As New OleDataAccess() Dim myDataSet As New DataSet() Dim SelectTable As New DataTable() Dim SelectView As New DataView() … Private Sub SetText() Select Case Application("Index") Case 0 lblFind1.Text = "检索号 " lblFind2.Text = "图书分类" lblFind3.Text = "图书名称" lblFind4.Text = "分类号" lblFind5.Text = "作者" lblFind6.Text = "有效性" Case 1 lblFind1.Text = "编号 " lblFind2.Text = "卷册名称" lblFind3.Text = "设计专业代码" lblFind4.Text = "专业代码" lblFind5.Text = "馆藏号" lblFind6.Text = "负责人 " Case 2 End Select End Sub
Private Sub Data2bind() DataGrid2.DataSource = SelectTable.DefaultView DataGrid2.DataBind() End Sub
Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click Application("Index") = 0 SetText() End Sub
Private Sub LinkButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton2.Click Application("Index") = 1 SetText() End Sub
Private Sub LinkFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkFind.Click Dim strSql As String Dim txt(6) As String Dim i As Int16 = 0 txt(0) = Trim(txtFind1.Text) txt(1) = Trim(txtFind2.Text) txt(2) = Trim(txtFind3.Text) txt(3) = Trim(txtFind4.Text) txt(4) = Trim(txtFind5.Text) txt(5) = Trim(txtFind6.Text) If txt(0) = "" And txt(1) = "" And txt(2) = "" And txt(3) = "" And txt(4) = "" And txt(5) = "" Then Exit Sub End If For i = 0 To 5 If txt(i) = "" Then txt(i) = "!!!!" Next Try If Application("Index") = 0 Then strSql = "SELECT JSH AS 检索号, TSMC AS 图书名称, TSFL AS 图书分类, CS AS 册数, FLH AS 分类号, DJ AS 单价, ZZ AS 作者, BZ AS 备注, ZBBM AS 主编部门, FBRQ AS 发布日期, SSRQ AS 实施日期, YXX AS 有效性, ZT AS 状态 FROM G2272.KPK " & _ " WHERE JSH LIKE '%" & txt(0) & _ "%' OR TSFL LIKE '%" & txt(1) & _ "%' OR TSMC LIKE '%" & txt(2) & _ "%' OR FLH LIKE '%" & txt(3) & _ "%' OR ZZ LIKE '%" & txt(4) & _ "%' OR YXX LIKE '%" & txt(5) & "%'" Else strSql = "SELECT SYSTEM_ID AS 编号, JCMC AS 卷册名称, GCDM AS 工程代码, ZYDM AS 专业代码, GCH AS 馆藏号, RKRQ AS 入库日期, TZZS AS 图纸张数, GDZB AS 归档正本, GDFB AS 归档副本, JC AS 说明书, ZSR AS 清册, ZBR AS 负责人 FROM DOCSADM.TWML " & _ " WHERE SYSTEM_ID LIKE '%" & txt(0) & _ "%' OR JCMC LIKE '%" & txt(1) & _ "%' OR GCDM LIKE '%" & txt(2) & _ "%' OR ZYDM LIKE '%" & txt(3) & _ "%' OR GCH LIKE '%" & txt(4) & _ "%' OR ZBR LIKE '%" & txt(5) & "%'" End If myDataSet = Application("DB").ExecuteSQL(strSql) DataGrid1.DataSource = myDataSet.Tables(0).DefaultView DataGrid1.DataBind() Catch ex As Exception ' MsgBox("错误信息", ex.Message & vbCrLf & "stack step") End Try End Sub End Class |