Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user

In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    saini arun
    wrote on last edited by
    #1

    I am getting error in the following code... --------------------------------------------------------------------------------------- /* odbAdapter is an object of OleDBAdapter objConnection is an object of OleDBConnection ds is a datatset */ odbAdapter = New OleDbDataAdapter("select * from tblEmployeeAttendance", objConnection) ap.Fill(ds, "EmpAttendance") Dim i As Integer = ds.Tables(0).Rows.Count --------------------------------------------------------------------------------------- When I add a watch on "ds.Tables(0).Rows" add check its Items property.... I see "In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user." Following is the structure of tblEmployeeAttendance table in an MS Acceess database. ID - AutoNumber EmployeeCode - Text AttendanceDate - date/Time AttendanceCode - Text AttendanceDescription - Text AttendanceDescriptionDate - Date/Time ------------------------------------------------- Do you have any idea about the cause of this error...? Thanks, Arun

    “The woods are lovely, dark and deep. But I have promises to keep, and miles to go before I sleep.”

    K 1 Reply Last reply
    0
    • S saini arun

      I am getting error in the following code... --------------------------------------------------------------------------------------- /* odbAdapter is an object of OleDBAdapter objConnection is an object of OleDBConnection ds is a datatset */ odbAdapter = New OleDbDataAdapter("select * from tblEmployeeAttendance", objConnection) ap.Fill(ds, "EmpAttendance") Dim i As Integer = ds.Tables(0).Rows.Count --------------------------------------------------------------------------------------- When I add a watch on "ds.Tables(0).Rows" add check its Items property.... I see "In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user." Following is the structure of tblEmployeeAttendance table in an MS Acceess database. ID - AutoNumber EmployeeCode - Text AttendanceDate - date/Time AttendanceCode - Text AttendanceDescription - Text AttendanceDescriptionDate - Date/Time ------------------------------------------------- Do you have any idea about the cause of this error...? Thanks, Arun

      “The woods are lovely, dark and deep. But I have promises to keep, and miles to go before I sleep.”

      K Offline
      K Offline
      Kschuler
      wrote on last edited by
      #2

      You have to supply the row index to view the data with in. In this case you would have to watch ds.Tables(0).Rows(0).ItemArray in order to see the first row in the table. But if you have Visual Studio 2005 you can do a QuickWatch and click on the magnify glass icon to actually load the whole database into a grid to view the data...not available in VS2003 though. Hope this helps.

      S 1 Reply Last reply
      0
      • K Kschuler

        You have to supply the row index to view the data with in. In this case you would have to watch ds.Tables(0).Rows(0).ItemArray in order to see the first row in the table. But if you have Visual Studio 2005 you can do a QuickWatch and click on the magnify glass icon to actually load the whole database into a grid to view the data...not available in VS2003 though. Hope this helps.

        S Offline
        S Offline
        saini arun
        wrote on last edited by
        #3

        Thanks for your help. Now, using Dim i As String = dsToupdate.Tables(0).Rows(0).Item(0) returns correct value. But how can I use it in looping through each row in the data set... Currently my code looks like this... For Each dr As DataRow In dsToupdate.Tables(0).Rows If (dsToupdate.Tables(0).Rows.Count > 0 And (Not (dr.Item("EAR_Employee_Code") Is Nothing))) Then dr.Item("EAR_Employee_Code") = strEmpCode dr.Item("EAR_Attendance_Date") = dtpAttendanceDate.Value dr.Item("EAR_Attendance_Code") = strIsPresent dr.Item("EAR_Attendance_Desc") = strDesc dr.Item("EAR_Attendance_DescDate") = strDescdate End If Next ------------------ can you please provide me a hint how to change the above code to access each item in each data row...? I am using VS2005. Thanks, Arun

        “The woods are lovely, dark and deep. But I have promises to keep, and miles to go before I sleep.”

        K 1 Reply Last reply
        0
        • S saini arun

          Thanks for your help. Now, using Dim i As String = dsToupdate.Tables(0).Rows(0).Item(0) returns correct value. But how can I use it in looping through each row in the data set... Currently my code looks like this... For Each dr As DataRow In dsToupdate.Tables(0).Rows If (dsToupdate.Tables(0).Rows.Count > 0 And (Not (dr.Item("EAR_Employee_Code") Is Nothing))) Then dr.Item("EAR_Employee_Code") = strEmpCode dr.Item("EAR_Attendance_Date") = dtpAttendanceDate.Value dr.Item("EAR_Attendance_Code") = strIsPresent dr.Item("EAR_Attendance_Desc") = strDesc dr.Item("EAR_Attendance_DescDate") = strDescdate End If Next ------------------ can you please provide me a hint how to change the above code to access each item in each data row...? I am using VS2005. Thanks, Arun

          “The woods are lovely, dark and deep. But I have promises to keep, and miles to go before I sleep.”

          K Offline
          K Offline
          Kschuler
          wrote on last edited by
          #4

          I guess I really don't understand what you are asking. I think you are doing it correctly. You do not need the dsToupdate.Tables(0).Rows.Count > 0 check because the For Each statement will not run if the table is empty. But I don't know of any other way to access each column in the data row. It's easier to user the column names like you did here, than to use the indexes of the columns. Unless you are setting all of the items to the same number, in which case you can loop through the columns inside your row loop...by adding something like this: For Each dc as DataColumn in dsToupdate.Tables(0).Columns dr.Item(dc.Name) = "VALUE" Next Hope this helps.

          S 1 Reply Last reply
          0
          • K Kschuler

            I guess I really don't understand what you are asking. I think you are doing it correctly. You do not need the dsToupdate.Tables(0).Rows.Count > 0 check because the For Each statement will not run if the table is empty. But I don't know of any other way to access each column in the data row. It's easier to user the column names like you did here, than to use the indexes of the columns. Unless you are setting all of the items to the same number, in which case you can loop through the columns inside your row loop...by adding something like this: For Each dc as DataColumn in dsToupdate.Tables(0).Columns dr.Item(dc.Name) = "VALUE" Next Hope this helps.

            S Offline
            S Offline
            saini arun
            wrote on last edited by
            #5

            Hi! With the help of your first post I successfully solved the issue. A 5 from my side. Thanks a bunch... :) Bye

            “The woods are lovely, dark and deep. But I have promises to keep, and miles to go before I sleep.”

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups