By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,994 Members | 2,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,994 IT Pros & Developers. It's quick & easy.

populating a dataset row

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.