Solved

Add to a dataset

Posted on 2007-03-23
3
160 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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