Solved

Add to a dataset

Posted on 2007-03-23
3
158 Views
Last Modified: 2010-04-23
I am getting an error "there is no postion in row 0"    when I try to perform the action   DsmhcpTreatmentPlan1.Tables(0).Rows(DataGrid2.CurrentCell.RowNumber).Item(4) = lngpatientid  

How can I fix this please.  

Thank you
0
Comment
Question by:running32
  • 2
3 Comments
 

Author Comment

by:running32
ID: 18781724
I do not have any records in the dataset and would need to add one I'm guessing.  The code below does not work it states.   Add is not a member of system.data.datatable

  Dim rowTemp As DataRow
            rowTemp = DsmhcpTreatmentPlan1.Tables(0).NewRow()
            rowTemp.Item("lngPatientid") = lngpatientid
            DsmhcpTreatmentPlan1.Tables(0).Add(rowTemp)
0
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
ID: 18782688
You're close:

  Dim rowTemp As DataRow
            rowTemp = DsmhcpTreatmentPlan1.Tables(0).NewRow()
            rowTemp.Item("lngPatientid") = lngpatientid
            DsmhcpTreatmentPlan1.Tables(0).Rows.Add(rowTemp)
0
 

Author Comment

by:running32
ID: 18793379
Thank you
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question