0

I have asp.net Membership configured, and when i do a "Select ident_current('aspnet_Users')" it retrieves NULL, and i have information there. If i do the same command to another table it returns right.

I'm doing that in Microsoft SQL Management Studio with 'SA' default login.

pnuts
  • 58,317
  • 11
  • 87
  • 139
ajrpc
  • 43
  • 6
  • 1
    That doesn't have any columns with the `IDENTITY` property IIRC so that isn't going to work. AFAIK it uses GUIDs as Primary Keys – Martin Smith Jun 07 '12 at 13:49

1 Answers1

2

You won't be able to do this on the aspnet_users table as it uses a Guid as its primary key - I guess the other table you tried had a standard int identity which is why it worked.

What exactly are you trying to do? If you want to get the generated Guid back from a query then use OUTPUT (see https://stackoverflow.com/a/1510529/1191903)

Community
  • 1
  • 1
Kevin Main
  • 2,334
  • 17
  • 28
  • i'm trying to combine the aspnet membership with my own user table. After creating the user in membership i'm trying to get the lastid to insert as FK in my User table – ajrpc Jun 07 '12 at 14:12
  • Are you are doing Membership.CreateUser() to create the user? or are you doing it manually? – Kevin Main Jun 07 '12 at 14:18
  • Yes i'm using Membership.CreateUser() – ajrpc Jun 07 '12 at 14:21
  • 2
    OK, well it returns a MembershipUser - you can then retrieve the ID via the ProviderUserKey property - give that a try and see if it works. – Kevin Main Jun 07 '12 at 14:23