Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add to a dataset

Posted on 2007-03-23
3
Medium Priority
?
163 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 2000 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

730 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