Solved

Add to a dataset

Posted on 2007-03-23
3
162 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

623 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