日期:2014-05-18 浏览次数:20537 次
Private Function LoadImages() As String Dim _db As New SQLHelp '创建数据库连接 Dim _Str As String = "" '定义一个空的字符串变量 Dim _dt As Data.DataTable = _db.DataTable("SELECT [path] FROM [Table]") '从数据表获取数据 If _dt.Rows.Count > 0 Then '判断数据是否为空,避免程序报错 For i As Integer = 0 To _dt.Rows.Count - 1 '循环组合字符串 If _Str = "" Then _Str = _dt.Rows(i)("path") Else _Str &= "|" & _dt.Rows(i)("path") End If Next Return "picc='" & _Str & "'" '组合成需要的字符串格式并输出 Else Return "" End If End Function