注册 登录
编程论坛 VB.NET论坛

小白求助,vb2005怎么邦定数据。。。。。

keisin 发布于 2008-04-24 15:55, 947 次点击
向来用2003,一下子换了2005用不来啊。。。望高人指点一下说一下步骤(sql2000的)
另求注释。。在下感激不尽
Try

            Cn.ConnectionString = connstr
            Cn.Open()
            cmd = New OleDbCommand(searchSql, Cn)
            dr = cmd.ExecuteReader()
            Dim i As Integer = 0 '定义i为整数赋予值为0'
            Do While dr.Read()
                ListView1.Items.Add(dr.GetString(0))
                If dr.GetInt32(2) = 1 Then
                    ListView1.Items(i).SubItems.Add("系统用户")
                Else
                    ListView1.Items(i).SubItems.Add("普通用户")
                End If
                i = i + 1
            Loop
            dr.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Cn.Dispose()
        cmd.Dispose()
0 回复
1