Showing posts with label home. Show all posts
Showing posts with label home. Show all posts

Monday, March 12, 2012

Requesting it(PK) after saving data with auto Prim.Key

Hi,

I have a page for saving a "home" data. As the page unloads I willredirect the user to the page on which he can add the photos to this"home".

Well I structured my photo adding page with first requesting the "homeID" which is an auto Integer (PK).
Because it's renaming the uploaded photos with the homeID and _01, _02...

Because of that i need to send the user to the photo adding page with "response.redirect.....aspx?homeID=....

homeID= ?

But I don't know how to get the homeID value, that the SQL Server automaticly selects for the data. As it is just saving it...

Thanks a lot.If you are using Stored Procedures, make an output parameter for your new ID, like

@.NewHomeId INT OUTPUT

then right after you do your insert

do

SET @.NewHomeId = SCOPE_IDENTITY()

and the value will be returned with the parameters. on the data layer, you can do

(assuming you output parmetere is the last in the params)
int val = (int)parms[parms.length - 1].Value;

Request for the permission of type System.Data.SqlClien

I got this message when running the same project at my work which I worked on
at home without encountering it. Thanks for the help.
Request for the permission of type System.Data.SqlClienAdditional
information: Request for the permission of type
System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
bic
Seems that sou didnt approve SQLServer Client to run in the special context
you are using it (wheter you use it with Biztalk or Sharepoint or etc..). It
depends on the type of underlying application you are using, in sharepoint
you have to configure a configfile, in other enviroments you have to set
..NET security for that. (Perhaps at home you have assigned Fulltrust --> To
all and in the comapany there is a domain policy which dont allow any
assemblies to run until they are aproced by some security administrator)
If you have further questions just raise a hand ;-)
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
"bic" <bic@.discussions.microsoft.com> schrieb im Newsbeitrag
news:825EDB65-0534-4A1C-B343-DAE786D8E601@.microsoft.com...
>I got this message when running the same project at my work which I worked
>on
> at home without encountering it. Thanks for the help.
> Request for the permission of type System.Data.SqlClienAdditional
> information: Request for the permission of type
> System.Data.SqlClient.SqlClientPermission, System.Data,
> Version=1.0.5000.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
> --
> bic

Request for the permission of type System.Data.SqlClien

I got this message when running the same project at my work which I worked o
n
at home without encountering it. Thanks for the help.
Request for the permission of type System.Data.SqlClienAdditional
information: Request for the permission of type
System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
--
bicSeems that sou didnt approve SQLServer Client to run in the special context
you are using it (wheter you use it with Biztalk or Sharepoint or etc..). It
depends on the type of underlying application you are using, in sharepoint
you have to configure a configfile, in other enviroments you have to set
.NET security for that. (Perhaps at home you have assigned Fulltrust --> To
all and in the comapany there is a domain policy which dont allow any
assemblies to run until they are aproced by some security administrator)
If you have further questions just raise a hand ;-)
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"bic" <bic@.discussions.microsoft.com> schrieb im Newsbeitrag
news:825EDB65-0534-4A1C-B343-DAE786D8E601@.microsoft.com...
>I got this message when running the same project at my work which I worked
>on
> at home without encountering it. Thanks for the help.
> Request for the permission of type System.Data.SqlClienAdditional
> information: Request for the permission of type
> System.Data.SqlClient.SqlClientPermission, System.Data,
> Version=1.0.5000.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
> --
> bic