To be clear, I want to add a new row to my DataTable, not to my 
actual database. The problem i am running into is that when I attempt 
to do the following..

DataRow dr= ds.Tables[0].NewRow();
dr["pay_adjust_id"] = //needs unique value here for primary key
dr["pay_adjust_vers_id"] = add_pay_adjust_vers_id;
dr["ctype_grp_cd"] = add_ctype_grp_cd;
dr["pay_adjust_type_cd"] = "P";
dr["proj_fy"] = add_proj_fy;
dr["proj_fm"] = add_proj_fm;
dr["prcnt"] = addPCNT;
dr["narrative"] = addNAR;

ds.Tables[0].Rows.Add(dr); 

it needs a unique value for the primary key. Does anyone know how I 
can come up with a unique value for my primary key column? Thanks!




--- In [EMAIL PROTECTED], shannon hall 
<[EMAIL PROTECTED]> wrote:
> If you aren't going to use the object for what it was
> designed for then I would suggest not using it at all.
>  Use a command object and fire off an insert statement
> and refill whatever "reader" type of object you
> implemented.
> 
> 
> 
> --- Trevor Thompson <[EMAIL PROTECTED]> wrote:
> 
> > well that's neither here nor there. there are many
> > reasons why i 
> > chose to take the route i have taken. my main
> > concern is how to add a 
> > unique id for the value of my column that i have
> > designated as my 
> > primary key in my dataset when i insert a new row.
> > any help with this 
> > would be greatly appreciated. thanks!
> > 
> > --- In [EMAIL PROTECTED],
> > shannon hall 
> > <[EMAIL PROTECTED]> wrote:
> > > If you are already using a dataadapter then why
> > not 
> > > use the functionality it provides?  Otherwise slam
> > > your data into a data table and fire off an insert
> > > stored procedure on the server and refresh the
> > data
> > > table after complete.
> > > 
> > > If this is a web application I would suggest using
> > > sp's and data reader's.
> > > 
> > > 
> > > 
> > > --- Trevor Thompson <[EMAIL PROTECTED]> wrote:
> > > 
> > > > i'm not using the dataAdapter to insert, update,
> > or
> > > > delete. i'm just 
> > > > using it to select and fill. and then i'm taking
> > > > care of the rest 
> > > > myself.
> > > > 
> > > > --- In [EMAIL PROTECTED],
> > > > shannon hall 
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > Not only will the table have to have a
> > Identity
> > > > insert
> > > > > but you should havea  data table derived from
> > a
> > > > data
> > > > > adapter with the appropriate select, insert,
> > > > update
> > > > > and delete statements.  This way, your data
> > > > integrity
> > > > > is insurred.
> > > > > 
> > > > > 
> > > > > --- Onur Bozkurt <[EMAIL PROTECTED]> wrote:
> > > > > 
> > > > > > why don't use use "Identity Insert" ? Create
> > a
> > > > > > column and make its Identity property to
> > true.
> > > > > >   ----- Original Message ----- 
> > > > > >   From: Trevor Thompson 
> > > > > >   To: [EMAIL PROTECTED] 
> > > > > >   Sent: Monday, August 16, 2004 9:42 PM
> > > > > >   Subject: [AspNetAnyQuestionIsOk] finding
> > > > largest
> > > > > > primary key value in my DataSet
> > > > > > 
> > > > > > 
> > > > > >   i need to insert a new row in my dataset
> > > > > > datatable. my datatable has 
> > > > > >   a primary key. i need to assign a unique
> > value
> > > > for
> > > > > > my primary key 
> > > > > >   column in my newly inserted row. how can i
> > do
> > > > > > this? i need to figure 
> > > > > >   out how to find the max value of primary
> > key
> > > > in my
> > > > > > dataset and add a 
> > > > > >   1 to it to have an unused unique value.
> > > > > > 
> > > > > >   tks! 
> > > > > > 
> > > > > > 
> > > > > >         Yahoo! Groups Sponsor 
> > > > > >               ADVERTISEMENT
> > > > > >              
> > > > > >        
> > > > > >        
> > > > > > 
> > > > > > 
> > > > > >
> > > > >
> > > >
> > >
> >
> --------------------------------------------------------------------
> > > > ----------
> > > > > >   Yahoo! Groups Links
> > > > > > 
> > > > > >     a.. To visit your group on the web, go
> > to:
> > > > > >    
> > > > > >
> > > >
> > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> > > > > >       
> > > > > >     b.. To unsubscribe from this group, send
> > an
> > > > > > email to:
> > > > > >    
> > > > > >
> > > >
> > [EMAIL PROTECTED]
> > > > > >       
> > > > > >     c.. Your use of Yahoo! Groups is subject
> > to
> > > > the
> > > > > > Yahoo! Terms of Service. 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > [Non-text portions of this message have been
> > > > > > removed]
> > > > > > 
> > > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > >               
> > > > > _______________________________
> > > > > Do you Yahoo!?
> > > > > Express yourself with Y! Messenger! Free.
> > Download
> > > > now. 
> > > > > http://messenger.yahoo.com
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > >           
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! Mail - 50x more storage than other
> > providers!
> > > http://promotions.yahoo.com/new_mail
> > 
> > 
> 
> 
> 
>               
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail is new and improved - Check it out!
> http://promotions.yahoo.com/new_mail



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to