Click here to Skip to main content
15,946,525 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
       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(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()

           Dim livi As New ListViewItem(ItemCol)

   End Sub
Updated 3-Jan-17 1:13am
Andy Lanng 3-Jan-17 6:23am    
What is 'Rs'?
Saadbinata 3-Jan-17 6:25am    
DIM Rs As New ADODB.Recordset "Public Varialble"
Saadbinata 3-Jan-17 6:28am    
Publically defined, because i use it on other places also
Richard MacCutchan 3-Jan-17 6:37am    
The message is quite clear, your statement (Rs.Fields(DS, "Register")) is incomplete.
Andy Lanng 3-Jan-17 6:37am    
Well the first thing I notice is that documentation for the Fields collection is piss poor :S

From what I can tell, the Fields object is a base collection of Field objects. I don't see any sort of override documented that could take in two arguments, so I'm stuck.

Then again, I am a C# senior, not VB so I may be missing something.

I could take a guess that Rs.Fields(DataSet, String) is a property selector, not just a method. If so then you'll have to find documentation specific to it's use :S

Sorry I cannot be of any further help

1 solution

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. What I am trying to do
  2. What I expect the outcome to be
  3. What is the actual (unexpected?) outcome
  4. What I have tried
  5. Why i am stuck

Just a suggestion ^_^
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900