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

📄 clstaskbook.vb

📁 一个很不错的实验室管理系统,用vb+sql编写,功能强大,界面美观
💻 VB
📖 第 1 页 / 共 2 页
字号:
                If k = MusterMainPartnum Then
                    Exit For
                End If
            Next
        Next
        k = 0
        For i = 0 To tblForDispaly.Rows.Count - 2
            For j = 0 To 1
                objTBpara = New TextBox()
                objTBpara.ID = "tbmainpart" & (k + 1)
                objTBpara.CssClass = "tt"
                objTBpara.ReadOnly = True
                objTBpara.Text = Trim(PubDataSet.Tables("mustermainpart").Rows(k)("provider"))
                tblForDispaly.Rows(i + 1).Cells(3 * j + 2).Controls.Add(objTBpara)
                k = k + 1
                If k = MusterMainPartnum Then
                    Exit For
                End If
            Next
        Next
    End Sub
    '函数名称:DisplayClimate
    '功能描述:根据Sql语句显示任务书的气候类型   
    '输入参数:strSql数据库查询语句       
    Public Sub DisplayClimate(ByVal strSql As String)
        Dim chkObj As CheckBox
        PubDataAdapter.SelectCommand.CommandText = strSql
        PubDataAdapter.Fill(PubDataSet, "tblClimate")
        With PubDataSet.Tables("tblClimate")
            For i = 0 To .Columns.Count - 1
                If .Rows.Count <> 0 Then
                    chkObj = Me.Controls(1).FindControl("chk" & .Columns(i).ColumnName)
                    chkObj.Checked = .Rows(0)(i)
                End If
            Next
        End With
    End Sub
    '函数名称:DisplayTestProperty
    '功能描述:根据Sql语句显示任务书的实验性质  
    '输入参数:strSql数据库查询语句       
    Public Sub DisplayTestProperty(ByVal strSql As String)
        Dim chkObj As CheckBox
        Dim objControl As Object
        PubDataAdapter.SelectCommand.CommandText = strSql
        PubDataAdapter.Fill(PubDataSet, "TestProperty")
        With PubDataSet.Tables("TestProperty")
            If .Rows.Count <> 0 Then
                For i = 0 To Me.Controls.Count - 1 '找到checkbox控件
                    If Me.Controls(i).GetType.Name = "CheckBox" Then
                        chkObj = Me.Controls(i)
                        If chkObj.Text.Trim = Trim(.Rows(0)(0)) Then
                            chkObj.Checked = True
                        End If
                    End If
                Next
            End If
        End With
    End Sub
    '函数名称:DispalyTestProject
    '功能描述:根据Sql语句显示任务书的实验项目
    '输入参数:strSql数据库查询语句 
    'tblForDisplay:显示实验项目的表格
    Public Sub DispalyTestProject(ByVal tblForDisplay As HtmlTable, ByVal strSql As String)
        Dim myrow As HtmlTableRow
        Dim mycell As HtmlTableCell
        PubDataAdapter.SelectCommand.CommandText = strSql
        PubDataAdapter.Fill(PubDataSet, "TaskBookTestProject")
        '动态生成表格
        Dim strstring(4) As String
        For i = 0 To PubDataSet.Tables("TaskBookTestProject").Rows.Count - 1
            myrow = New HtmlTableRow()
            For j = 0 To 3
                mycell = New HtmlTableCell()
                mycell.Controls.Add(New LiteralControl())
                myrow.Cells.Add(mycell)
            Next
            tblForDisplay.Rows.Add(myrow)
        Next
        '取得实验项目内容
        For i = 0 To PubDataSet.Tables("TaskBookTestProject").Rows.Count - 1
            With tblForDisplay.Rows(i + 6)
                .Cells(0).InnerText = CStr(i + 1)
                .Cells(0).Align = "center"
                .Cells(0).ColSpan = 1
                .Cells(1).InnerText = PubDataSet.Tables("TaskBookTestProject").Rows(i)("project")
                .Cells(1).Align = "center"
                .Cells(1).ColSpan = 1
                .Cells(2).InnerText = PubDataSet.Tables("TaskBookTestProject").Rows(i)("teststandard")
                .Cells(2).Align = "center"
                If IsDBNull(PubDataSet.Tables("TaskBookTestProject").Rows(i)("period")) = False Then
                    .Cells(3).InnerText = PubDataSet.Tables("TaskBookTestProject").Rows(i)("period") & "h"
                    .Cells(3).Align = "center"
                End If
            End With
        Next
    End Sub
    '函数名称:DisplaySpecProject
    '功能描述:根据Sql语句显示任务书的实验项目
    '输入参数:strSql数据库查询语句 
    'tblForDisplay:显示特殊项目的表格
    Public Sub DisplaySpecProject(ByVal tblForDisplay As HtmlTable, ByVal strSql As String)
        PubDataAdapter.SelectCommand.CommandText = strSql
        PubDataAdapter.Fill(PubDataSet, "SpecialProject")
        If PubDataSet.Tables("SpecialProject").Rows.Count <> 0 Then
            myRow = New HtmlTableRow()
            For intLoopIndex = 0 To 3
                myCell = New HtmlTableCell()
                myCell.Controls.Add(New LiteralControl())
                myRow.Cells.Add(myCell)
            Next
            With tblForDisplay '表头
                .Rows.Add(myRow)
                .Rows(0).Align = "center" '居中显示                
                .Rows(0).Cells(0).Width = 100
                .Rows(0).Cells(0).InnerText = "序号"
                .Rows(0).Cells(1).Width = 200
                .Rows(0).Cells(1).InnerText = "特殊项目名称"
                .Rows(0).Cells(2).Width = 300
                .Rows(0).Cells(2).InnerText = "实验方法"
                .Rows(0).Cells(3).Width = 160
                .Rows(0).Cells(3).InnerText = "周期"
            End With
            For intLoopIndex = 0 To PubDataSet.Tables("SpecialProject").Rows.Count - 1
                myRow = New HtmlTableRow()
                For i = 0 To 3
                    myCell = New HtmlTableCell()
                    myCell.Controls.Add(New LiteralControl())
                    myRow.Cells.Add(myCell)
                Next
                With tblForDisplay '实验项目
                    .Rows.Add(myRow)
                    .Rows(.Rows.Count - 1).Align = "center"
                    .Rows(.Rows.Count - 1).Cells(0).InnerText = CStr("T" & CStr(intLoopIndex + 1))
                    .Rows(.Rows.Count - 1).Cells(1).InnerText = _
                    Trim(PubDataSet.Tables("SpecialProject").Rows(intLoopIndex)("projectname"))
                    If Not IsDBNull(PubDataSet.Tables("SpecialProject").Rows(intLoopIndex)("projectmethod")) Then
                        .Rows(.Rows.Count - 1).Cells(2).InnerText = _
                        Trim(PubDataSet.Tables("SpecialProject").Rows(intLoopIndex)("projectmethod"))
                    End If
                    If Not IsDBNull(PubDataSet.Tables("SpecialProject").Rows(intLoopIndex)("period")) Then
                        .Rows(.Rows.Count - 1).Cells(3).InnerText = _
                        Trim(PubDataSet.Tables("SpecialProject").Rows(intLoopIndex)("period")) & "h"
                    End If
                End With
            Next
        End If
    End Sub
    '函数名称:DisplayTestID
    '功能描述:根据Sql语句显示任务书编号
    '输入参数:strSql数据库查询语句 
    'drpDropDownList:显示任务书编号的下拉框
    Public Sub DisplayTestID(ByVal strSql As String, ByVal drpDropDownList As DropDownList)
        PubDataAdapter.SelectCommand.CommandText = strSql
        PubDataAdapter.Fill(PubDataSet, "tblTestID")
        With drpDropDownList
            .DataSource = PubDataSet.Tables("tblTestID")
            .DataTextField = "testid"
            .DataValueField = "testid"
            .DataBind()
        End With
    End Sub
    '函数名称:DisplayTaskBook
    '功能描述:根据strAddress和strTestID显示任务书
    '输入参数:strAddress地址
    'strTestID任务书编号strTblTechParaName技术参数显示表名称
    'strTblMainPartName主关部件显示表名称
    'strTblTestProject实验项目表
    'strTblSpecProjectName特殊项目表
    Public Sub DisplayTaskBook(ByVal strAddress As String, ByVal strTestID As String, _
    ByVal strTblTechParaName As HtmlTable, ByVal strTblMainPartName As HtmlTable, _
    ByVal strTblTestProject As HtmlTable, ByVal strTblSpecProjectName As HtmlTable)
        '技术参数和主关部件
        PubStrSql = "select * from mustertechpara where testid='" _
        & strTestID & "'" _
        & " and address='" & strAddress & "'"
        DisplayTechPara(strTblTechParaName, PubStrSql)

        PubStrSql = "select * from mustermainpart where testid='" _
        & strTestID & "'" _
        & " and address='" & strAddress & "'"
        DisplayMainPart(strTblMainPartName, PubStrSql)
        '气候类型
        PubStrSql = "select N,SN,T,ST from TaskBook where TestID='" & strTestID & "'" _
        & " and Address='" & strAddress & "'"
        DisplayClimate(PubStrSql)
        '试验性质
        PubStrSql = "select TestProperty from testobjdescription  where testid='" _
        & strTestID & "'" & " and address='" & strAddress & "'"
        DisplayTestProperty(PubStrSql)
        '测试项目
        PubStrSql = "select distinct taskbookprj.project,taskbookprj.TestId," _
        & "taskbookprj.TestXiada,taskbookprj.TestStandard,taskbookprj.Period," _
        & "taskbookprj.state,taskbookprj.Qualified,taskbookprj.TestResult," _
        & "taskbookprj.Remark,taskbookprj.TestBeginTime,taskbookprj.TestEndTime," _
        & "taskbookprj.PicFile,testproject.standardserial,testproject.project," _
        & "testproject.period,testproject.methodtemplate,testproject.standardtemplate" _
        & " from taskbookprj,testproject where taskbookprj.teststandard=" _
        & "testproject.standardserial and taskbookprj.project=testproject.project" _
        & "  and taskbookprj.testid='" & strTestID _
        & "'" & " and address='" & strAddress & "'" _
        & " order by TestStandard"
        DispalyTestProject(strTblTestProject, PubStrSql)
        '显示特殊项目
        PubStrSql = "select distinct testid,ProjectName,ProjectMethod,Period from SpecialProject" _
        & " where Testid='" & strTestID & "' and Address='" & strAddress & "'"
        DisplaySpecProject(strTblSpecProjectName, PubStrSql)
    End Sub
End Class

⌨️ 快捷键说明

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