Dim Condition As String = ""
Condition = Me.txtChaxun.Text.Trim()
Dim DBstr As String = "select * from WF_DOCUMENT where "
Dim ConditionValue As Int16 = CType(Me.DdlChaxun.SelectedValue.Trim(), Int16)
If Me.Panel2.Visible = True Then
Condition = Me.ddlyear.SelectedItem.Text.Trim()
End If
If ConditionValue > 0 And Not Condition = "" Then
If chaxunflag = 1 Then
Select Case ConditionValue '设置查询条件语句
Case 1
DBstr += "DocTitle like " & "'%" & Condition & "%'"
Case 2
DBstr += "OutWord like " & "'%" & Condition & "%'"
Case 3
DBstr += "OutSerial like " & "'%" & Condition & "%'"
Case 4
DBstr += "KeyWord like " & "'%" & Condition & "%'"
Case 5
DBstr = "select a.*,b.dname from WF_DOCUMENT a,depart b where a.DocSendDep=b.dno and b.dname like " & "'%" & Condition & "%'"
Case 6
DBstr += "WriteUserName like " & "'%" & Condition & "%'"
Case 7
DBstr += "JinjiClass like " & "'%" & Condition & "%'"
Case 8
'DBstr += "SaveTime like " & "'%" & Condition & "%'"
Dim monthchax As String = ""
Dim datechax As String = ""
If Me.ddlmonth.SelectedItem.Text.Trim() = "未选" And Me.ddldate.SelectedItem.Text.Trim() = "未选" Then
DBstr += "datepart(yy,SaveTime)='" + Condition + "'"
ElseIf Not Me.ddlmonth.SelectedItem.Text.Trim() = "未选" And Me.ddldate.SelectedItem.Text.Trim() = "未选" Then
monthchax = Me.ddlmonth.SelectedItem.Text.Trim()
DBstr += "datepart(yy,SaveTime)='" + Condition + "' and datepart(mm,SaveTime)='" + monthchax + "'"
ElseIf Not Me.ddlmonth.SelectedItem.Text.Trim() = "未选" And Not Me.ddldate.SelectedItem.Text.Trim() = "未选" Then
monthchax = Me.ddlmonth.SelectedItem.Text.Trim()
datechax = Me.ddldate.SelectedItem.Text.Trim()
DBstr += "datepart(yy,SaveTime)='" + Condition + "' and datepart(mm,SaveTime)='" + monthchax + "' and datepart(dd,SaveTime)='" + datechax + "'"
Else
Response.Write("<script language=javascript>alert('您选择的日期查询条件不对!');</script>")
Exit Function
End If
End Select