两条语句的区别?If Combo1.Text = "进价" Or Combo1.Text = "数量" Or Combo
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/17 20:18:02
两条语句的区别?
If Combo1.Text = "进价" Or Combo1.Text = "数量" Or Combo1.Text = "金额" Then
Set rs = conn.Execute("select * from purchase where " & Combo1.Text & "=" & Combo2.Text)
Else
Set rs = conn.Execute("select * from purchase where " & Combo1.Text & "='" & Combo2.Text & "'")
End If
请问("select * from purchase where " & Combo1.Text & "=" & Combo2.Text) 与
("select * from purchase where " & Combo1.Text & "='" & Combo2.Text & "'") 的区别在哪里?
If Combo1.Text = "进价" Or Combo1.Text = "数量" Or Combo1.Text = "金额" Then
Set rs = conn.Execute("select * from purchase where " & Combo1.Text & "=" & Combo2.Text)
Else
Set rs = conn.Execute("select * from purchase where " & Combo1.Text & "='" & Combo2.Text & "'")
End If
请问("select * from purchase where " & Combo1.Text & "=" & Combo2.Text) 与
("select * from purchase where " & Combo1.Text & "='" & Combo2.Text & "'") 的区别在哪里?
区别就在于参数的数据类型
("select * from purchase where " & Combo1.Text & "=" & Combo2.Text)
此时的Combo2.Text 是数字型
这句等同于
("select * from purchase where " & Combo1.Text & "=" & Combo2.Text&")
Set rs = conn.Execute("select * from purchase where " & Combo1.Text & "='" & Combo2.Text & "'")
此时的Combo2.Text 是文本型
原代码中的判断是为了区别数据类型
这里就要讲一下 ' 和 " 区别
在SQL 语句里 ' 是使用在文本型中 如 '文本' '张三'
" 是用在数字型中 如 "12" "45"
值得注意的是 '12' 和 "12" 是有本质不同的 前面的是文本不能加减运算; 后面"12" 是数字型可以加减运算
##### 帮你注释一下吧 #####
If Combo1.Text = "进价" Or Combo1.Text = "数量" Or Combo1.Text = "金额" Then '//判断选择的是 进价或数量或金额则执行以下操作
Set rs = conn.Execute("select * from purchase where " & Combo1.Text & "=" & Combo2.Text) '// 因为进价或数量或金额都是数字型(后面可能要进行加减运算)所以执行这条.
Else
Set rs = conn.Execute("select * from purchase where " & Combo1.Text & "='" & Combo2.Text & "'") '//其它的应该是文本型所以执行这条.
End If
("select * from purchase where " & Combo1.Text & "=" & Combo2.Text)
此时的Combo2.Text 是数字型
这句等同于
("select * from purchase where " & Combo1.Text & "=" & Combo2.Text&")
Set rs = conn.Execute("select * from purchase where " & Combo1.Text & "='" & Combo2.Text & "'")
此时的Combo2.Text 是文本型
原代码中的判断是为了区别数据类型
这里就要讲一下 ' 和 " 区别
在SQL 语句里 ' 是使用在文本型中 如 '文本' '张三'
" 是用在数字型中 如 "12" "45"
值得注意的是 '12' 和 "12" 是有本质不同的 前面的是文本不能加减运算; 后面"12" 是数字型可以加减运算
##### 帮你注释一下吧 #####
If Combo1.Text = "进价" Or Combo1.Text = "数量" Or Combo1.Text = "金额" Then '//判断选择的是 进价或数量或金额则执行以下操作
Set rs = conn.Execute("select * from purchase where " & Combo1.Text & "=" & Combo2.Text) '// 因为进价或数量或金额都是数字型(后面可能要进行加减运算)所以执行这条.
Else
Set rs = conn.Execute("select * from purchase where " & Combo1.Text & "='" & Combo2.Text & "'") '//其它的应该是文本型所以执行这条.
End If
两条语句的区别?If Combo1.Text = "进价" Or Combo1.Text = "数量" Or Combo
vb画tan函数图像If Combo1.Text = "tan" ThenFor x = -15 To 15 Step
请教下面VB 代码的意思 Private Sub Command1_Click() If Combo1.Text ""
=IF(OR(F9="",F9=0),"",TEXT(INT(F9),"
VB中的表达式怎么写sq1 = Trim(Text4.Text)IF.THENsq1="SS" or like "SS%
if (A.Text == "身份证" && (B.Text.Length != 15||B.Text.Length !
word or text 文本谁有?
TextBox1.Text = Mid(TextBox1.Text,1,Len(TextBox1.Text) -
txtShow.Text = txtShow.Text.Substring(0,txtShow.Text.Length
if you can't make a telephone call,or send a text message.这句
Plain Text Resume - Enter N/A if resume is uploaded or attac
Listen carefully ,or you won't understand the text well.(改为条