Home All Groups Group Topic Archive Search About
Author
29 Mar 2005 12:02 PM
RTT
i have a script that insert a variable amount of rows in a table. each row
is identified by an autonumber by SQL

how can i find out the number of the newly added rows without having to much
troubles?

Author
29 Mar 2005 12:37 PM
Peter Proost
I'm not sure but I think you can use a sql command and then use it's
ExecuteNonQuery method It should return the number of rows affected

hth greetz Peter

Show quoteHide quote
"RTT" <R**@pandora.be> schreef in bericht
news:OFSxAdFNFHA.2020@TK2MSFTNGP10.phx.gbl...
> i have a script that insert a variable amount of rows in a table. each row
> is identified by an autonumber by SQL
>
> how can i find out the number of the newly added rows without having to
much
> troubles?
>
>
Author
29 Mar 2005 1:39 PM
..:: Kevin ::..
Hello,

If you need to get back the last autonumber value of the last record that
has been entered then I would suggest you have a read of this article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconRetrievingIdentityOrAutonumberValues.asp

Hope this is of some help?

Thanks

Kevin

Show quoteHide quote
"Peter Proost" wrote:

> I'm not sure but I think you can use a sql command and then use it's
> ExecuteNonQuery method It should return the number of rows affected
>
> hth greetz Peter
>
> "RTT" <R**@pandora.be> schreef in bericht
> news:OFSxAdFNFHA.2020@TK2MSFTNGP10.phx.gbl...
> > i have a script that insert a variable amount of rows in a table. each row
> > is identified by an autonumber by SQL
> >
> > how can i find out the number of the newly added rows without having to
> much
> > troubles?
> >
> >
>
>
>
Author
29 Mar 2005 1:47 PM
Peter Proost
Hi

I misread the question so my solution won't help you out sorry, but Kevin's
link probably will

Greetz Peter

"..:: Kevin ::.." <Ke***@discussions.microsoft.com> schreef in bericht
news:7E7064EB-9EC2-4C0C-A8C9-3C8CBF4AF3F0@microsoft.com...
> Hello,
>
> If you need to get back the last autonumber value of the last record that
> has been entered then I would suggest you have a read of this article:
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconRetrievingIdentityOrAutonumberValues.asp
Show quoteHide quote
>
> Hope this is of some help?
>
> Thanks
>
> Kevin
>
> "Peter Proost" wrote:
>
> > I'm not sure but I think you can use a sql command and then use it's
> > ExecuteNonQuery method It should return the number of rows affected
> >
> > hth greetz Peter
> >
> > "RTT" <R**@pandora.be> schreef in bericht
> > news:OFSxAdFNFHA.2020@TK2MSFTNGP10.phx.gbl...
> > > i have a script that insert a variable amount of rows in a table. each
row
> > > is identified by an autonumber by SQL
> > >
> > > how can i find out the number of the newly added rows without having
to
> > much
> > > troubles?
> > >
> > >
> >
> >
> >
Author
29 Mar 2005 2:46 PM
RTT
thxs, i still have to tweak it some more so it fits my needs perfectaly but
is does the trick.. thxs


"..:: Kevin ::.." <Ke***@discussions.microsoft.com> wrote in message
news:7E7064EB-9EC2-4C0C-A8C9-3C8CBF4AF3F0@microsoft.com...
> Hello,
>
> If you need to get back the last autonumber value of the last record that
> has been entered then I would suggest you have a read of this article:
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconRetrievingIdentityOrAutonumberValues.asp
Show quoteHide quote
>
> Hope this is of some help?
>
> Thanks
>
> Kevin
>
> "Peter Proost" wrote:
>
> > I'm not sure but I think you can use a sql command and then use it's
> > ExecuteNonQuery method It should return the number of rows affected
> >
> > hth greetz Peter
> >
> > "RTT" <R**@pandora.be> schreef in bericht
> > news:OFSxAdFNFHA.2020@TK2MSFTNGP10.phx.gbl...
> > > i have a script that insert a variable amount of rows in a table. each
row
> > > is identified by an autonumber by SQL
> > >
> > > how can i find out the number of the newly added rows without having
to
> > much
> > > troubles?
> > >
> > >
> >
> >
> >
Author
29 Mar 2005 3:05 PM
Cor Ligthert
RTT

A command.executescalar with an SQL string for @@identity gives you the last
inserted identity.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_globals_50u1.asp

I hope this helps,

Cor
Author
29 Mar 2005 4:04 PM
Veign
In what language? How did you add the record? What does this question have
to do with all the newsgroups you posted to?

You have posted this question to both VB and DotNet newsgroups..

Check out the @@Identity statement

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/


Show quoteHide quote
"RTT" <R**@pandora.be> wrote in message
news:OFSxAdFNFHA.2020@TK2MSFTNGP10.phx.gbl...
> i have a script that insert a variable amount of rows in a table. each row
> is identified by an autonumber by SQL
>
> how can i find out the number of the newly added rows without having to
much
> troubles?
>
>