views:

560

answers:

3

I am trying to insert data to UserCars table using ObjectDataSource Insert Method. the userId(FOREIGN KEY) I am trying to insert is GUID type.

corresponding PRIMARY key is UserId(uniqeidentifier) in aspnet_users table which is part of Membrship shema

the userId(guid) = JustCreateduser so it means it shoukd be the same vaues. however I get this error of conflict....

Any one can help me, please? I got headache already...

A: 

I'm not certain, but I believe I read about issues with guid keys on sql with asp.net. Can you convert it to integer keys?

Rick Ratayczak
Mocrosoft's asp.net membership provider uses Guids.
Burt
+1  A: 

Have you confirmed that the guid does actually exist in the aspnet_users table prior to inserting it into the UserCars table?

Amanda Myer
I call this after registration and put other details as well, so It should be there. Problem resolved Thankyou!
Alex
+1  A: 

See if it really does exist:

SELECT * FROM aspnet_users WHERE UserIDGUID = @TheGuidBeingInserted

If you're having trouble getting info on what's actually happening, do a trace in SQL Profiler, capturing SQL statement completion, SP statement completion, RPC call completion, and RPC output parameter (just in case the GUID is coming back from a call).

That should give you some ideas to be able to proceed forward with solving the problem.

Emtucifor
Thank you very much! I have used another approach wich worked. But I will keep in mind your suggestions in future Thank you!
Alex