列表视图控件。需要帮助 [英] List view control. Need assistance

查看:72
本文介绍了列表视图控件。需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我输入了代码并显示了这样的错误:



Rs.Fields(DS,Register)这是错误的区域显示



物业访问必须分配给物业或使用其价值。



请尊敬的老年人做在这方面的事情。



我尝试过:



I have type the code and it showing such kind of error:

Rs.Fields(DS, "Register") "This is the area where the error shows"

Property access must assign to the property or use its value.

Please respected seniors do something in such regards.

What I have tried:

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click

       Dim DDR As ADODB.Recordset
       Dim DS As DataSet
       ListView1.View = View.Details
       ListView1.GridLines = True
       ConnectDatabase()
       DDR.Open("select * from Register", CON)

       Rs.Fields(DS, "Register")

       For i As Integer = 0 To DS.Tables(0).Columns.ToString.Count - 1
           ListView1.Columns.Add(DS.Tables(0).Columns(i).ColumnName.ToString())
       Next

       ListView1.Columns(0).Text = "Serial No."
       ListView1.Columns(1).Text = "Employee Name"
       ListView1.Columns(2).Text = "Father Name"
       ListView1.Columns(3).Text = "NIC No."
       ListView1.Columns(4).Text = "Tel. Phone No."
       ListView1.Columns(5).Text = "Address"
       ListView1.Columns(6).Text = "Designation"
       ListView1.Columns(7).Text = "Department"
       ListView1.Columns(8).Text = "Status"
       ListView1.Columns(9).Text = "Medical"
       ListView1.Columns(10).Text = "Graduity"
       ListView1.Columns(11).Text = "PFund"
       ListView1.Columns(12).Text = "Transport"
       ListView1.Columns(13).Text = "Employement Date"


       Dim ItemCol(100) As String

       For i As Integer = 0 To DS.Tables(0).Rows.Count - 1
           For j As Integer = 0 To DS.Tables(0).Columns.Count - 1
               ItemCol(j) = DS.Tables(0).Rows(i)(j).ToString()
           Next

           Dim livi As New ListViewItem(ItemCol)
           ListView1.Items.Add(livi)
       Next

   End Sub

推荐答案

所以通过评论我们发现了需求ement是从给定数据集填充记录集。给出错误的方法永远不应该用于此目的,因此确切的错误消息与问题无关。



鉴于此新信息,我能够找到本页:

将数据集转换为VB记录集 [ ^ ]



这导致回到这篇文章:

转换ADO.NET DataTable的最简单代码到ADODB.Recordset [ ^ ]



我快速浏览了一下它似乎是ex你正在寻找什么。



注意:OP:尝试在下一次问题中描述你的预期结果。

尝试思考沿着这些方向:

So via the comments we found that the requirement is to populate the recordset from a given dataset. The method giving the error should never be used for this purpose, so the exact error message is not relevant to the issue.

Given this new information I was able to find this page:
convert Dataset to VB recordset[^]

Which led right back here to this article:
Simplest code to convert an ADO.NET DataTable to an ADODB.Recordset[^]

I took a quick look and it appears to be exactly what you're looking for.

NB: OP: Try to describe your intended outcome in the question next time.
Try thinking along these lines:


  1. 我想做什么

  2. 我期待什么结果是

  3. 实际(意想不到的?)结果是什么

  4. 我尝试了什么

  5. 为什么我被卡住了





只是一个建议^ _ ^



Just a suggestion ^_^


这篇关于列表视图控件。需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆