Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6134347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:20:37+00:00 2026-05-23T17:20:37+00:00

I am trying to populate a dataset with data from a dynamic SQL dataset

  • 0

I am trying to populate a dataset with data from a dynamic SQL dataset created by a code generator (PDSA). If I want the first row of data, or I use a specific “Where” clause to retrieve 1 row, I have no problem. But, when I loop through the dataset that has four entries, instead of getting the four entries, I get the first row 4 times. Any idea why?

Code Example:

Dim DS_C as New DS
Dim dr_A As DS_C.Tbl_ARow               

    Me.DS_C.Tbl_A.Clear()

    Dim bo As PDSA.DataLayer.tbl_BDC = New PDSA.BusinessLayer.tbl_B

    With bo
        .ConnectionString = AppConfig.SQLConnectString
        .SelectFilter = PDSA.DataLayer.tbl_BDC.SelectFilters.All
        .WhereFilter = tbl_BDC.WhereFilters.None
        .Load()
    End With        

    For Each dr As DataRow In bo.DataSet.Tables(0).Rows

        dr_A = DS_C.Tbl_A.NewRow

        With dr_A
            .CustomerID = bo.CustomerID
            .FirstName = bo.FirstName
            .LastName = bo.LastName
            .Street = bo.Street
            .City = bo.City
            .State = bo.State
            .ZipCode = bo.ZipCode
        End With

        DS_C.Tbl_A.AddTbl_ARow(dr_A)

    Next

If I try to change it to use dr instead of bo , it wont accept it.

I get:

.CustomerID = dr.CustomerID(CustomerID is not a member of System.Data.DataRow) 

If I try using DS_C.Tbl_ARow

For Each dr As DS_C.Tbl_ARow In bo.DataSet.Tables(0).Rows

I get type ‘DS_C.Tbl_ARow’ is not defined

If I try :

For Each dr As DS.Tbl_ARow In bo.DataSet.Tables(0).Rows 

I get:

System.InvalidCastException = {"Unable to cast object of type 'System.Data.DataRow' to type 'TblXLMajorPerilsRow'."} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:20:37+00:00Added an answer on May 23, 2026 at 5:20 pm

    You need to access it like this:

    .CustomerID = dr("CustomerID");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to populate a drop down list with data from an SQL database
I'm trying to use a BULK INSERT statement to populate a large (17-million-row) table
Trying to populate a uitable from xml, xml is already parsed. for (Row* fighter
I am trying to populate a jqGrid with data from a web service. I
I'm trying to populate a table with user information in a MS SQL database
I am trying to process 114,000 rows in a dataset (populated from an oracle
I have generated a dataset that contains data spanning thirty days. Im trying to
I'm trying to populate a second dropdown in a dynamic way based on a
I am trying to populate an (editable) gridview in ASP.NET with a table from
I am trying to populate a row in a table given a key value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.