You are here: Re: Return pkID of last saved record - ASPUpload & @@Identity « MsSQL Server « IT news, forums, messages
Re: Return pkID of last saved record - ASPUpload & @@Identity

Posted by pb648174 on 11/27/05 21:16

After calling the Upload.Save method, loop through the files, saving
them one at a time. As you save each one, retrieve the @@identity
property inside the stored proc you are using to insert the new file
entry. As Celko suggests, You could also use the path and filename as a
key if you want, since ASPUpload takes care of renaming files if they
have the same name. Just using an identity column is a heck of alot
easier though when you have things you want to relate to those files.

Tony Rogerson wrote:
> Hi,
>
> Use SCOPE_IDENTITY() to get the last inserted IDENTITY value for that
> statement...
>
> insert blha......
>
> select pkID = SCOPE_IDENTITY()
>
> --
> Tony Rogerson
> SQL Server MVP
> http://sqlserverfaq.com - free video tutorials
>
>
> "BigJohnson" <craig.johnson@westleigh.co.uk> wrote in message
> news:1132937707.195947.101060@g49g2000cwa.googlegroups.com...
> > We're using ASPUpload as a tool to upload files to our server and save
> > the details to SQLServer. However, I have an application where I need
> > to return the pkID of the just saved file. I'm assuming that I could
> > use the @@Identity command but cannot get this to function.
> >
> > Has anyone used this command with ASPUpload with an success, or any
> > other methods that could be used?
> >
> > Thanks.
> >

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация