473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

populating a dataset row

C#

How do I populate a row in a dataset ? I have created a class called Job.
In this class I have a few methods such as CreateJob and FetchJob. FetchJob
returns a DataSet of the Job table. The idea being, when I want to view or
modify a certain Job , I call this method, passing in the unique ID and get
back a dataset with that row in it.

In the Job class though, how do I populate a row with the relevant info? My
first attempt was to find the Job using a SQL stored procedure and then using
a DataReader I could read all the field values. I used the
JobDataSet.Job.AddJobRow() method, which requires a value for each field on
the Job table, but it doesnt ask me for the Key field value (Job.JobObj). Am
I doing this the wrong way? I see there is another method though, which is
simply JobDataSet.Job.NewRow() which doesnt require any params, is this what
I should use?

Thanks

Steve
Sep 19 '05 #1
1 1332
The problem is that you don't appear to be adding the row. If you use
NewRow() then make sure you add that row to the table using
DataTable.Rows.Add(WhateverRowYouJustCreated);
"Steve" <St***@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
C#

How do I populate a row in a dataset ? I have created a class called Job.
In this class I have a few methods such as CreateJob and FetchJob.
FetchJob
returns a DataSet of the Job table. The idea being, when I want to view
or
modify a certain Job , I call this method, passing in the unique ID and
get
back a dataset with that row in it.

In the Job class though, how do I populate a row with the relevant info?
My
first attempt was to find the Job using a SQL stored procedure and then
using
a DataReader I could read all the field values. I used the
JobDataSet.Job.AddJobRow() method, which requires a value for each field
on
the Job table, but it doesnt ask me for the Key field value (Job.JobObj).
Am
I doing this the wrong way? I see there is another method though, which
is
simply JobDataSet.Job.NewRow() which doesnt require any params, is this
what
I should use?

Thanks

Steve

Sep 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Juan | last post by:
When populating a dataset I get an error if the data being retrieved includes a string field with a Null value: "Not valid store type: DBNull". What kinf of data type can i define in the dataset to...
0
by: amber | last post by:
I've been trying to figure out how to get 2 datasets to populate a report/subreport - and I think I'm on the right track...just having a few problems somewhere... I have created a dataset (.xsd)...
2
by: Janus | last post by:
Hello. I need a little advice for populating the treeview control. I dont want my application to hang while populating the treeview, there is a lot of data what's the best approach? Maybe...
2
by: Robert | last post by:
I'm sure this is a fairly basic question, but I've been looking all over the web for days for suggestions on how to do this. I've got a datagrid that's bound to a dataset on my form. It includes...
1
by: John | last post by:
Hi all, I have an interesting situation. I have a datagrid I'm currently populating using a dataset but now I need to introduce some extra records into this. I'm unsure of which method to use....
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
4
by: Paul | last post by:
I sometimes get a timeout error when populating my datagrid, the code is WizardConnection.Open() UpdateCommand.CommandText = "EXECUTE sp_assign_user '" & PhysOffice.SelectedValue & "', '" &...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
6
by: p.mc | last post by:
Hi all, I have a MS SQLServer database which has two tables, 'images' and 'photographers'. The photographer table contains a field for PhotographerID and a one for PhotographerName. The image...
1
by: mike11d11 | last post by:
For some reason I'm getting no data populating in my crystal report. I built my crystal report off my dataset in my project, and I fill the dataset when opening the main form, and count the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.