麻烦高手解释下以下VB程序.很急很急....

来源:百度知道 编辑:UC知道 时间:2024/05/21 09:40:39
condstr = "" '以下根据用户输入的数据构造一个条件表达式
If Trim(Text1(0).Text) <> "" Then
If condstr = "" Then
condstr = "姓名 like '" + Trim(Text1(0).Text) + "'"
Else
condstr = condstr + " and 姓名 like '" + Trim(Text1(0).Text) + "'"
End If

Private Sub Command1_Click()
condstr = "" '以下根据用户输入的数据构造一个条件表达式
If Trim(Text1.Text) <> "" Then '如果去掉前后空格后,文本框的字符串不为空
If condstr = "" Then
condstr = "姓名 like '" + Trim(Text1.Text) + "'" '在文本框的字符串前添加字符“姓名 like”
Else
condstr = condstr + " and 姓名 like '" + Trim(Text1.Text) + "'" '此语句永远不可能执行,因为前文有 condstr =""
End If
End If
End Sub