Click here to Skip to main content
15,905,967 members
Home / Discussions / C#
   

C#

 
GeneralRe: Auto Login Via a Link Pin
Łukasz Nowakowski30-Jun-11 4:15
Łukasz Nowakowski30-Jun-11 4:15 
GeneralRe: Auto Login Via a Link Pin
Not Active30-Jun-11 4:32
mentorNot Active30-Jun-11 4:32 
AnswerRe: Auto Login Via a Link Pin
Eddy Vluggen30-Jun-11 9:27
professionalEddy Vluggen30-Jun-11 9:27 
GeneralRe: Auto Login Via a Link Pin
dbongs7-Jul-11 20:46
dbongs7-Jul-11 20:46 
QuestionSewer Colony Optimization Algorithm Pin
Anubhava Dimri29-Jun-11 23:28
Anubhava Dimri29-Jun-11 23:28 
AnswerRe: Sewer Colony Optimization Algorithm Pin
Pete O'Hanlon29-Jun-11 23:38
mvePete O'Hanlon29-Jun-11 23:38 
AnswerRe: Sewer Colony Optimization Algorithm Pin
Ravi Bhavnani30-Jun-11 9:55
professionalRavi Bhavnani30-Jun-11 9:55 
GeneralRe: Sewer Colony Optimization Algorithm Pin
Roger Wright1-Jul-11 20:34
professionalRoger Wright1-Jul-11 20:34 
Questionreading from different files asynchronously Pin
igalep13229-Jun-11 8:21
igalep13229-Jun-11 8:21 
AnswerRe: reading from different files asynchronously Pin
Alan N29-Jun-11 8:57
Alan N29-Jun-11 8:57 
GeneralRe: reading from different files asynchronously Pin
igalep13229-Jun-11 9:02
igalep13229-Jun-11 9:02 
GeneralRe: reading from different files asynchronously Pin
SledgeHammer0129-Jun-11 9:18
SledgeHammer0129-Jun-11 9:18 
GeneralRe: reading from different files asynchronously Pin
BobJanova30-Jun-11 2:40
BobJanova30-Jun-11 2:40 
AnswerRe: reading from different files asynchronously Pin
PIEBALDconsult29-Jun-11 14:35
mvePIEBALDconsult29-Jun-11 14:35 
GeneralRe: reading from different files asynchronously Pin
igalep13229-Jun-11 19:57
igalep13229-Jun-11 19:57 
AnswerRe: reading from different files asynchronously Pin
Shameel30-Jun-11 1:02
professionalShameel30-Jun-11 1:02 
QuestionGet Current Identity value of the table using LINQ. Pin
madhubabu29-Jun-11 6:41
madhubabu29-Jun-11 6:41 
AnswerRe: Get Current Identity value of the table using LINQ. Pin
Dave Kreskowiak29-Jun-11 7:22
mveDave Kreskowiak29-Jun-11 7:22 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
madhubabu29-Jun-11 8:05
madhubabu29-Jun-11 8:05 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
AspDotNetDev29-Jun-11 8:56
protectorAspDotNetDev29-Jun-11 8:56 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
madhubabu29-Jun-11 9:44
madhubabu29-Jun-11 9:44 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
Dave Kreskowiak29-Jun-11 9:35
mveDave Kreskowiak29-Jun-11 9:35 
You've still got a problem. Unless you return the ID number in the same sceop as the SQL INSERT you can get back the wrong ID number. Your SQL INSERT statement has to be followed by a SELECT SCOPE_IDENTITY(), like this in order to return the correct ID number:
INSERT INTO tablename (fields) VALUES (values);
SELECT SCOPE_IDENTITY() AS [LastIdentity];

It's better to do this as a stored procedure than to assemble it and use it with ExecuteQuery directly with this batch.

When your INSERT code runs, it'll automatically return the identity value that was assigned to back to you, without having to worry about another user screwing things up by inserting another record in the table between the first users trips to the database.

GeneralRe: Get Current Identity value of the table using LINQ. Pin
AspDotNetDev29-Jun-11 8:55
protectorAspDotNetDev29-Jun-11 8:55 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
Dave Kreskowiak29-Jun-11 9:25
mveDave Kreskowiak29-Jun-11 9:25 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
madhubabu29-Jun-11 9:47
madhubabu29-Jun-11 9:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.