网络编程 
首页 > 网络编程 > 浏览文章

vb.net 数组参与SQL语句的查询范例

(编辑:jimmy 日期: 2026/3/6 浏览:3 次 )

首先定义数组,我是同事session传值的

复制代码 代码如下:
Dim struser As New List(Of String)
struser = Session("chooseuser")
strruser = ""

For a = 0 To struser.Count - 1
If a = 0 Then
strruser = "'" & struser.Item(a).ToString.Trim & "'"
Else
strruser = strruser & " , " & "'" & struser.Item(a).ToString.Trim & "'"
End If
Next

然后就可以吧strruser带入到sql语句中使用。

上一篇:URL中去除指定参数实现C#代码
下一篇:不使用web服务(Service)实现文本框自动完成扩展